Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter wasanajones

    (@wasanajones)

    oops, I don’t think that is the correct schema, but it really doesn’t change the question

    https://developers.google.com/search/docs/data-types/faqpage

    Plugin Support kenil802

    (@kenil802)

    Hi @wasanajones,

    Regarding your query, our developer is checking on how to add JSON structured data to FAQ and whether it is possible to add it or not. Once we check on it, we will get back to you with an update.

    Regards,
    Kenil Shah

    Thread Starter wasanajones

    (@wasanajones)

    thanks, I’m pretty sure it can be added to existing php templates, should be relatively easy

    +1 on this feature request please!

    +1 to this feature. It’s so easy to implement and it give us a big improve.

    I added this code to solve this:


    // Add FAQ Page structured data when it’s necessary
    add_action( ‘wp_head’, function () {

    $post = get_post();

    if ( ! $post instanceof WP_Error && $post->post_type == ‘faq’ ) {

    $json = [
    “@context” => “https://schema.org/”,
    “@type” => “FAQPage”,
    “mainEntity” => [
    “@type” => “Question”,
    “name” => $post->post_title,
    “acceptedAnswer” => [
    “@type” => “Answer”,
    “text” => $post->post_content
    ]
    ]
    ];

    $html = ‘<script type=”application/ld+json”>’;
    $html .= json_encode($json);
    $html .= ‘</script>’;

    echo $html;
    }
    } );

    Thread Starter wasanajones

    (@wasanajones)

    hi – thanks, but in attempting to add to functions.php I get errors starting at $json

    no real explanation other than syntax error – tried changing ” marks but still flagged

    +1 on this feature request please!

    > thanks, but in attempting to add to functions.php I get errors starting at $json

    @wasanajones maybe you need more cleanup: have you tried replacing all curly quotes ” AND ‘ with simple quotes and adding a closing ” after the schema url instead of &#_8221;?

    Unfortunately the concept does not work for me, my plugin-made FAQ pages are on noindex to avoid double content. Instead I run FAQ groups all over the website on pages of all kind.
    I am now trying to figure out how to detect any occurrence of a faq group and run the JSON on that page too. That’s a little bit more tricky.

    • This reply was modified 4 years, 9 months ago by cebln.
    • This reply was modified 4 years, 9 months ago by cebln.
    • This reply was modified 4 years, 9 months ago by cebln.
    • This reply was modified 4 years, 9 months ago by cebln.
    • This reply was modified 4 years, 9 months ago by cebln.

    I am now thinking that JSON-LD is not the best approach in this case and html microcode is easier to implement as that only means some extra markup instead of calculations.

    Not sure this plugin is still maintained as I have not seen support here recently. Maybe this can be forked?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘structured data QAPage’ is closed to new replies.