Yoast SEO
Notice-Level PHP Error in Titles on Search Pages (1 post)

  1. Michael Dozark
    Posted 3 years ago #

    WordPress version: 3.4.2
    WordPress SEO version:

    I did this: Ran a search query using my site's sidebar search form.

    I expected the plugin to do this: Return the wp_title according to the options I set on the plugins page.

    Instead it did this:
    Returned the following notice-level error in addition to the title
    Trying to get property of non-object in {directory_path}/wp-includes/post-template.php on line 30

    I have WP_DEBUG currently set to TRUE for testing a theme I am developing, so I see the notice level errors. Error persisted after switching to Twenty Eleven theme and deactivating other plugins.

    Long story short, what looks to be happening is that in the wpseo_get_value function, $post_id for a search page that has no results does not explicitly equal zero, and is somehow empty. If I edit line 14 of wpseo-functions.php to read
    if ( $postid === 0 || empty( $post_id ) ) {
    the error no longer shows.


Topic Closed

This topic has been closed to new replies.

About this Plugin

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

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by Michael Dozark
  • This topic is not resolved
  • WordPress version: 3.4.2