• Resolved brit77

    (@brit77)


    I do not use breadcrumbs on this site and do not have them enabled in the Yoast settings.

    After the latest update, the error log on my site is full of the following notice:
    Notice: Trying to access array offset on value of type null in /home/site/public_html/wp-content/plugins/wordpress-seo/src/generators/schema/breadcrumb.php on line 99

    This is triggered only when I visit a numbered blog page (i.e. /blog/page/2/) but not the main blog page or any other pages or posts. On these numbered blog pages, I see the yoast-schema-graph script in the site’s head, but I do not see this on other pages.

    Is there anything I can do on my end to prevent the schema script from being unnecessarily inserted on these pages?

    Thanks,
    Sarah

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Michael Ti?a

    (@mikes41720)

    Hi @brit77

    Could you confirm you are using the latest version of Yoast SEO for WordPress v16.5?

    We do know that even if you aren’t using the Yoast SEO breadcrumbs and have disabled it in the settings, it will still output the breadcrumb schema itself in the Yoast SEO schema graph.

    If you want to disable the schema entirely or modify the default schema output (such as to remove the breadcrumbs), we’d like to refer you to our Schema API documentation here – https://developer.yoast.com/features/schema/api/

    Thread Starter brit77

    (@brit77)

    Hi @mikes41720,
    Yes, can confirm I am using v16.5.

    The notice is triggered only on the numbered blog pages, I assume because the script is inserted on these pages but there are no breadcrumbs. So, I can just insert the following code to prevent the script from running on these pages? (though the plugin apparently knows not to insert the script on all other pages!)
    add_filter( 'wpseo_schema_graph_pieces', 'remove_breadcrumbs_from_schema', 11, 2 );

    @mikes41720

    The code snippet you have picked up is incomplete, you need to copy-paste the complete code as referenced here: https://developer.yoast.com/features/schema/api/#removing-graph-pieces.

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

    Another workaround to rule out the cause of the breadcrumb error. We recommend you perform a conflict check.

    Often, we see problems occur in combination with another plugin or theme. The fastest way to rule out any conflict, is to deactivate all non-Yoast plugins and switch to a standard theme like Twenty Twenty.

    Please test this on your development or staging site, if you have one. If not, we recommend using the Health Check & Troubleshooting plugin. This plugin has a troubleshooting mode, which does not affect normal visitors to your site.

    If you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide that will walk you through the process: How to check for plugin conflicts

    We hope this helps you to figure out the culprit plugin or theme that was causing the breadcrumb error.

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

    Thread Starter brit77

    (@brit77)

    This issue appears to be resolved as of Yoast version 1.6. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Schema Notice in error log while not using breadcrumbs’ is closed to new replies.