Trying to get property of non-object in link-template.php
-
I am not sure what caused this error to start appearing on my pages. On some pages it only shows twice and others it shows four or five times. The full message is:
Notice: Trying to get property of non-object in /public_html/dev/wordpress/wp-includes/link-template.php on line 323Notice: Trying to get property of non-object in /public_html/dev/wordpress/wp-includes/link-template.php on line 337
From my searching I found that a similar error message occurs when a site is hacked and the link-template.php file name is changed.
The sections of code correspond to the following code:
/** * Retrieve the permalink for current page or page ID. * * Respects page_on_front. Use this one. * * @since 1.5.0 * * @param int|object $post Optional. Post ID or object. * @param bool $leavename Optional, defaults to false. Whether to keep page name. * @param bool $sample Optional, defaults to false. Is it a sample permalink. * @return string The page permalink. */ function get_page_link( $post = false, $leavename = false, $sample = false ) { global $wp; $post = get_post( $post ); if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) ) $link = home_url('/'); else $link = _get_page_link( $post, $leavename, $sample ); /** * Filter the permalink for a page. * * @since 1.5.0 * * @param string $link The page's permalink. * @param int $post_id The ID of the page. * @param bool $sample Is it a sample permalink. */ return apply_filters( 'page_link', $link, $post->ID, $sample ); }
Any help would be appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Trying to get property of non-object in link-template.php’ is closed to new replies.