• Resolved anselmbauer

    (@anselmbauer)


    Hi,

    we are using the WordPress Rest API plugin to include posts to our website.
    Now we want to add the WPSSO information to the JSON API. Is there a way (function) to get the generated meta tags to put it into the JSON response (Currently we are doing an http call to the page and parse it, which is horribly slow)?

    Thanks in advance

    https://ww.wp.xz.cn/plugins/wpsso/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author JS Morisset

    (@jsmoriss)

    Absolutely, and it’s been on my ToDo list for a bit.

    Here’s how you can get the array of meta tags:

    $wpsso = Wpsso::get_instance();
    $meta_tags = $wpsso->head->get_header_array();

    Let me know if you have any questions, and if you have any code to share, that would be great too. 😉

    js.

    Plugin Author JS Morisset

    (@jsmoriss)

    BTW, I assumed you wanted the meta tags as an array, but you can also get the whole HTML block as well. 😉

    $wpsso = Wpsso::get_instance();
    $meta_html = $wpsso->head->get_header_html();

    js.

    Thread Starter anselmbauer

    (@anselmbauer)

    Hi, thanks for your help.

    Unfortunately, the methods return only the standard title and description of the blog, not the post specific ones.

    Do I somehow have to generate them before?

    Thanks

    Plugin Author JS Morisset

    (@jsmoriss)

    That’s odd. You can also provide the method with a post ID:

    $post = get_queried_object();
    $wpsso = Wpsso::get_instance();
    $meta_tags = $wpsso->head->get_header_array( $post->ID );
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WPSSO in JSON API’ is closed to new replies.