Title: PHP Warnings cluttering error log
Last modified: February 15, 2021

---

# PHP Warnings cluttering error log

 *  [derrick_w](https://wordpress.org/support/users/derrick_w/)
 * (@derrick_w)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warnings-cluttering-error-log/)
 * Thank you for this plugin. While it continued working, two conditions triggered
   warnings.
    1. When WP’s own twentytwentyone theme’s 404.php was used.
    2. When updating any post/page, after clearing the check box to unhide its title.
 * Warning case #1:
    `Attempt to read property "post_title" on null in .../hide-
   page-and-post-title.php on line 90` Warning case #2: `Undefined array key "hpt_headertitle"
   in .../hide-page-and-post-title.php on line 102`
 * Suggested hack case #1. $post == NULL. Replace the line (was 90):
    `$this->title
   = $post->post_title;` with this test of the $post var using ‘instanceof’
 *     ```
       	//$this->title = $post->post_title;
       	if ($post instanceof WP_Post) {
           		$this->title = $post->post_title;
       	}
       ```
   
 * Whenever $post is not a WP_Post object, skip trying to read the title property.
 * Suggested hack case #2. Replaced the line (was around 102):
    `$new = $_POST[ 
   $this->hpt_slug ] ;` with this test of the $_POST key
 *     ```
       	//$new = $_POST[ $this->hpt_slug ] ;
       	$new = isset( $_POST[ $this->hpt_slug ] ) ? $_POST[ $this->hpt_slug ] : NULL;
       ```
   
 * Silence is golden.
    -  This topic was modified 5 years, 3 months ago by [derrick_w](https://wordpress.org/support/users/derrick_w/).

The topic ‘PHP Warnings cluttering error log’ is closed to new replies.

 * ![](https://ps.w.org/hide-page-and-post-title/assets/icon-128x128.png?rev=1703131)
 * [Hide Page And Post Title](https://wordpress.org/plugins/hide-page-and-post-title/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hide-page-and-post-title/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hide-page-and-post-title/)
 * [Active Topics](https://wordpress.org/support/plugin/hide-page-and-post-title/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hide-page-and-post-title/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hide-page-and-post-title/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [derrick_w](https://wordpress.org/support/users/derrick_w/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/php-warnings-cluttering-error-log/)
 * Status: not resolved