Support » Plugin: Schema App Structured Data » Disable on certain pages for errors

  • Resolved joseph43

    (@joseph43)


    Hello all

    How to disable schema plugin output on certain pages? For example if i want to deactivate it on categories? Can you give me the function for this? For structured data errors and other reasons

    Joseph

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author vberkel

    (@vberkel)

    Hi Joseph,

    For pages and posts Editor screen we have an checkbox to disable the Schema output in the metabox options for the plugin.

    Otherwise, for broader cases, there is a wordpress filter ‘hunch_schema_markup’ you can use from PHP. You would add the filter for your certain page types or as needed for your scenario.

    // Our filter callback function
    function example_callback( $schemaJson, $postType ) {
    // (maybe) modify $schemaJson
    return $schemaJson;
    }
    add_filter( ‘hunch_schema_markup’, ‘example_callback’, 10, 3 );

    Let me know if you have any questions.

    Thanks,
    Mark

    I don’t understand, if i add this exact code on the categories pages schema app markup will disappear? Or i have to modify something in this code?

    Plugin Author vberkel

    (@vberkel)

    If you add the exact code nothing will change. You need to customize the PHP function to suit your needs; do you want to filter out a post type or based on contents of the schema data? You would have to define the filtering criteria and implement with PHP there. In those situations you would modify the PHP code “// (maybe) modify $schemaJson” to override the $schemajson object if the criteria is met.

    I’ve updated our documentation, the FAQ page with this information. At this time you can use the filter to override the markup for groups of pages.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable on certain pages for errors’ is closed to new replies.