Support » Plugin: The SEO Framework » Extend class properties

  • Resolved davideC00

    (@dcazzorla)


    How can i extend the json of a class added by the Framework SEO?

    For example Framework SEO adds with json a class named website. If i need to extend website, with my plugin Im adding a second class with the same name, website.

    How can I just to have one website class after extending your properties with mines?

    Pic of the problem
    Structured Data testing

    • This topic was modified 2 years, 5 months ago by davideC00.
Viewing 1 replies (of 1 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Adjusting the JSON isn’t possible without unconventional reflections and buffering, yet.

    We recently proposed a solution for this, however: https://github.com/sybrew/the-seo-framework/issues/440 (in the first comment)

    We plan to ship that in at least two major releases from now (2020).

    Until then, I suggest only building and improving your own version and disabling the conflicting output from The SEO Framework.

    P.S. I recommend building an array, and then converting it to JSON via json_encode(). This way, you make sure it’s secure and parsable.

    e.g.

    $data = [
       '@context' => 'https://schema.org',
       '@type'    => 'WebSite',
       // etc...
    ];
    
    printf( '<script type="application/ld+json">%s</script>', json_encode( $data, JSON_UNESCAPED_SLASHES ) );

    Cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘Extend class properties’ is closed to new replies.