WordPress.org

Support

Support » Plugins and Hacks » Yoast SEO » Notice-Level PHP Error in Titles on Search Pages

Notice-Level PHP Error in Titles on Search Pages

  • Michael Dozark

    @michaeldozark

    WordPress version: 3.4.2
    WordPress SEO version: 1.2.8.7

    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.

    http://wordpress.org/extend/plugins/wordpress-seo/

  • The topic ‘Notice-Level PHP Error in Titles on Search Pages’ is closed to new replies.
Skip to toolbar