• Resolved Avo Avetisyan

    (@loyaltyoverroyalty)


    Issue:
    The FAQ v2 block (wpseopress/faq-block-v2) is generating a “Block contains unexpected or invalid content” validation error in the WordPress admin console.

    Root Cause:
    There appears to be an HTML entity encoding mismatch in the JSON-LD schema generated by the block’s save function:

    • Expected: <p>2</p> (HTML entities without semicolons)
    • Actual: <p>2</p> (HTML entities with semicolons)

    Technical Details:

    • Block Save Function: The JavaScript save function in /public/editor/blocks/faq-v2/index.js generates JSON-LD with inconsistent HTML entity encoding.
    • WordPress Validation: Core validation compares the saved content with the content retrieved from the database and finds a mismatch.
    • Validation Error: This mismatch triggers the “Block contains unexpected or invalid content” error.
    • Workaround: Rolling back to the previous SEOPress version resolves the issue, which suggests this is a regression in the latest release.

    Environment:

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi,

    we are not able to reproduce the issue on our side.

    From the blocks list view, select the FAQ v2 block, open the contextual menu, and choose Copy.

    Then paste the code here using the Code block so we can test your content in our local setup.

    Thanks

    Thread Starter Avo Avetisyan

    (@loyaltyoverroyalty)

    <!-- wp:wpseopress/faq-block-v2 {"schema":{"@context":"https://schema.org","@type":"FAQPage","url":"https://xxx-multisite.local/auto-draft/","@id":"https://xxx-multisite.local/auto-draft/","mainEntity":[{"@type":"Question","url":"https://xxx-multisite.local/auto-draft/#1","name":"1","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u003cp\u003e2\u003c/p\u003e"}},{"@type":"Question","url":"https://xxx-multisite.local/auto-draft/#3","name":"3","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u003cp\u003e4\u003c/p\u003e"}},{"@type":"Question","url":"https://xxx-multisite.local/auto-draft/#5","name":"5","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u003cp\u003e6\u003c/p\u003e"}}]}} -->
    <div class="wp-block-wpseopress-faq-block-v2">
    <!-- wp:details {"placeholder":"Type a question"} -->
    <details id="1" class="wp-block-details"><summary>1</summary>
    <!-- wp:paragraph {"placeholder":"Add your answer"} -->
    <p>2</p>
    <!-- /wp:paragraph -->
    </details>
    <!-- /wp:details -->
    <!-- wp:details {"placeholder":"Type a question"} -->
    <details id="3" class="wp-block-details"><summary>3</summary>
    <!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
    <p>4</p>
    <!-- /wp:paragraph -->
    </details>
    <!-- /wp:details -->
    <!-- wp:details {"placeholder":"Type a question"} -->
    <details id="5" class="wp-block-details"><summary>5</summary>
    <!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
    <p>6</p>
    <!-- /wp:paragraph -->
    </details>
    <!-- /wp:details -->
    {"@context":"https://schema.org","@type":"FAQPage","url":"https://xxx-multisite.local/auto-draft/","@id":"https://xxx-multisite.local/auto-draft/","mainEntity":[{"@type":"Question","url":"https://xxx-multisite.local/auto-draft/#1","name":"1","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"&lt;p&gt;2&lt;/p&gt;"}},{"@type":"Question","url":"https://xxx-multisite.local/auto-draft/#3","name":"3","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"&lt;p&gt;4&lt;/p&gt;"}},{"@type":"Question","url":"https://xxx-multisite.local/auto-draft/#5","name":"5","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"&lt;p&gt;6&lt;/p&gt;"}}]}</div>
    <!-- /wp:wpseopress/faq-block-v2 -->
    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Can you confirm that if you create a new page, then you add a new FAQ block (v2), enter some questions/answers and finally hit Save, you have an error when refreshing the page?

    Thread Starter Avo Avetisyan

    (@loyaltyoverroyalty)

    Yep, exactly

    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi,

    The validation error occurs because your FAQ block was most likely created with an older version of the block format. The block is trying to update to the new format but can’t automatically migrate the existing content.

    Quick fix:

    • Delete the existing FAQ block
    • Add a new FAQ block and re-enter your questions/answers
    • Save the page Alternatively, you can try editing the existing block (make any small change) and save it again – this should update it to the new format.

    The block will work correctly once recreated. We made a fix that should prevent this in the future which should ship in 9.3.0.

    Cheers!

    Thread Starter Avo Avetisyan

    (@loyaltyoverroyalty)

    Thank you @rainbowgeek

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘The FAQ v2 block ERROR’ is closed to new replies.