WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WordPress SEO by Yoast] error notices

[Plugin: WordPress SEO by Yoast] error notices

Viewing 2 replies - 1 through 2 (of 2 total)
  • thomask
    Participant

    @thomask

    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.

    thomask
    Participant

    @thomask

    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));
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] error notices’ is closed to new replies.