Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Breadcrumbs broken on empty post archives #443

javorszky opened this Issue Dec 11, 2013 · 4 comments


None yet
2 participants

To reproduce

  • have WP_DEBUG turned on
  • Create a custom post type. I shall call mine mini-me.
  • Do not create any posts.
  • Navigate to the archive page, say http://localhost/sandbox/mini-me/ (depending on your permalinks and setup)
  • bask at the glory of this message: Notice: Trying to get property of non-object in /Users/yourusername/Sites/site/wp-content/plugins/wordpress-seo/frontend/class-breadcrumbs.php on line 321, and note that there is no last item on the breadcrumb


Internally it depends on get_post(), but since there are no posts, that will return false / null, thus it can`t get the post type of the post object, because the post object does not even exist.


jdevalk commented Dec 15, 2013

I can't reproduce it, where you using a specific theme?

BTW: it doesn't rely on get_post either, it relies on get_post_type_object, which is somewhat different :)

It's a custom post type archive, and the ptarchive key is set in the array with no content. That part of the code calls to WP's get_post_type() (https://github.com/Yoast/wordpress-seo/blob/master/frontend/class-breadcrumbs.php#L161) function, which either returns false or goes away to fetch the post with get_post( $post ) (https://github.com/WordPress/WordPress/blob/master/wp-includes/post.php#L1037).

The theme is custom that I'm writing from scratch.


jdevalk commented Dec 15, 2013

Ok it took a bit, but I reproduced it, fix coming in.

@jdevalk jdevalk closed this in caded2f Dec 15, 2013

Awesome, thank you :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment