The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Yoast SEO
[Plugin: WordPress SEO by Yoast] error notices (3 posts)

  1. thomask
    Posted 4 years ago #

    error notice in breadcrumbs:

    Notice: Trying to get property of non-object in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/wordpress-seo/frontend/class-breadcrumbs.php on line 248

    again you should not use menu_name for frontend name, so it should be $post_type_obj->labels->name

    But in my case - (http://money.mediacentrum.cz/reference/?kraj=jihocesky-kraj&produkt=money-s5&branze=it-a-elektronika) - it is combination of custom post type and taxonomy with zero results and in this case $link['ptarchive'] is FALSE so $post_type_obj = get_post_type_object( $link['ptarchive'] ); is false as well so it throws the error above


  2. thomask
    Posted 4 years ago #

    so the problem is on line 125

    $links[] = array( 'ptarchive' => get_post_type() );

    but the problem is, that when there is zero posts, the get_post_type returns false, as global $post returns false;

    so imo it should return probably 404 or even better - there should be a special breacrumb for zero results archive pages ($post = NULL), and it's check should be first.

  3. thomask
    Posted 4 years ago #

    i have done a workaround using filter

    add_filter( 'wpseo_breadcrumb_links', 'mc_breadcrumb_filter' );
    function mc_breadcrumb_filter ($links) {
      foreach ($links as $key => &$link) {
              /* ... my other filters */
              if (isset($link['ptarchive']) &&  $link['ptarchive']==false) {
                global $wp_query;
                $link['ptarchive'] = $wp_query->query_vars['post_type'];
      return (array_values($links));

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic