Changing Yoast ld+json string (Wordpress, Yoast, PHP)


Hey Everybody,

Since the new update from Yoast it is not possible to edit the ld+json string (structured data). Using this function:

  public function update()
        add_filter('wpseo_json_ld_output', [$this, 'change_yoast_ld_json_file'], 10, 1);

    public function change_yoast_ld_json_file($data)

        $data[] = 'add some data';
        return $data;


When I dump the $data ill get this:

  string(105) "Please use the "wpseo_schema_*" filters to extend the Yoast SEO schema data - see the WPSEO_Schema class."

Talking about the wpseo_schema_* filter. To be honest, I cannot really find any information about that :confused:. How can I edit this JSON string, without forcing to buying the Yoast local.


Nevermind found it (website is down)

Use a function to set array