PHP Warning: Attempt to read property “post_title” on null
-
Plugin throws PHP Warning as follows…
PHP Warning: Attempt to read property "post_title" on null in /directory/path/public_html/wp-content/plugins/hide-page-and-post-title/hide-page-and-post-title.php on line 90
I believe Warning is produced because it is possible for pages/posts/post types to be saved in draft mode prior to a slug being generated.
Possible fix would be to ensure all pages/posts/post types to have a slug.
Re-writing line 90 as follows…
$this->title = isset( $post->post_title ) ? $post->post_title : '';
…should also eliminate this issue.
- The topic ‘PHP Warning: Attempt to read property “post_title” on null’ is closed to new replies.