• Resolved vovachampion

    (@vovachampion)


    Hi,
    is there a way to disable WebPage schema on the site?

    found some solution

    function disable_yoast_json_ld($data) {
    (defined('WPSEO_VERSION')) {
    unset($data['@graph'][0]['@type']); }
    return $data;

    }

    add_filter('wpseo_json_ld_output', 'disable_yoast_json_ld', 10, 1);

    But not quite sure about it ??
    Any suggestions?

    • This topic was modified 1 year, 4 months ago by vovachampion.
    • This topic was modified 1 year, 4 months ago by vovachampion.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @vovachampion,

    Thanks for using the Yoast SEO plugin. Please refer to our Schema – API documentation to disable graph pieces.

    Thread Starter vovachampion

    (@vovachampion)

    Thanks for answer @maybellyne!
    If I understand correctly, it is enough to add, right?
    add_filter( 'wpseo_schema_webpage', '__return_false' );

    Thread Starter vovachampion

    (@vovachampion)

    or this?

    add_filter( 'wpseo_schema_graph_pieces', 'remove_webpage_from_schema', 11, 2 );
    
    function remove_webpage_from_schema( $pieces, $context ) {
    return \array_filter( $pieces, function( $piece ) {
    return ! $piece instanceof \Yoast\WP\SEO\Generators\Schema\WebPage;
    } );
    }

    • This reply was modified 1 year, 4 months ago by vovachampion.
    • This reply was modified 1 year, 4 months ago by vovachampion.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to disable WebPage schema?’ is closed to new replies.