Title: PHP Warning Errors &#8211; functions.php line 269
Last modified: December 19, 2021

---

# PHP Warning Errors – functions.php line 269

 *  Resolved [grafis](https://wordpress.org/support/users/snackmaster/)
 * (@snackmaster)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/)
 * The following warning appears in my error logs 24,852 times in the last 3 months,
   no issues viewing the site. Anything I can or should do?
 * `PHP Warning: Attempt to read property "ID" on null in /var/www/domain.com/public_html/
   wp-content/themes/astrid/functions.php on line 269`

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Kharis Sulistiyono](https://wordpress.org/support/users/kharisblank/)
 * (@kharisblank)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15178929)
 * [@snackmaster](https://wordpress.org/support/users/snackmaster/) I am sorry to
   hear about the issue you’re experiencing.
 * To fix it, try editing the Astrid theme’s _functions.php_ file to find this line:
 * `$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode',
   true );`
 * Replace it with:
 *     ```
       if ( is_singular() ) {
       	$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
       }
       ```
   
 * Hope that helps.
 * Regards,
    Kharis
 *  Thread Starter [grafis](https://wordpress.org/support/users/snackmaster/)
 * (@snackmaster)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15180228)
 * Appreciate the help! After updating the functions file the error on line 269 
   is gone but I have a new one on line 276 – Undefined variable $single_toggle 
   in /var/www/domain.com/public_html/wp-content/themes/astrid/functions.php on 
   line 276
 *     ```
       /**
        * Header image check
        */
       function astrid_has_header() {
       	$front_header = get_theme_mod('front_header_type' ,'image');
       	$site_header = get_theme_mod('site_header_type', 'nothing');
       	global $post;
       	if ( !is_404() || !is_search() ) {
       		if ( is_singular() ) {
       	$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
       }
       	} else {
       		$single_toggle = false;
       	}
   
       	if ($single_toggle != '') {
       		return 'has-single';
       	} else {
       		if ( get_header_image() && ( $front_header == 'image' && is_front_page() ) || ( $site_header == 'image' && !is_front_page() ) ) {
       			return 'has-header';
       		} elseif ( ($front_header == 'shortcode' && is_front_page()) || ($site_header == 'shortcode' && !is_front_page()) ) {
       			return 'has-shortcode';
       		} elseif ( ($front_header == 'video' && is_front_page()) || ($site_header == 'video' && !is_front_page()) ) {
       			return 'has-video';
       		}		
       	}
       }
       ```
   
    -  This reply was modified 4 years, 5 months ago by [grafis](https://wordpress.org/support/users/snackmaster/).
    -  This reply was modified 4 years, 5 months ago by [grafis](https://wordpress.org/support/users/snackmaster/).
 *  Thread Starter [grafis](https://wordpress.org/support/users/snackmaster/)
 * (@snackmaster)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15257285)
 * Anyone else experience this issue? It’s an endless stream in my error log.
    [@kharisblank](https://wordpress.org/support/users/kharisblank/)
   fix posted above worked for the original error but created a new one.
 *  [Kharis Sulistiyono](https://wordpress.org/support/users/kharisblank/)
 * (@kharisblank)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15257407)
 * I am sorry for the delay [@snackmaster](https://wordpress.org/support/users/snackmaster/).
 * Try adding this line right after the function opening.
 * `$single_toggle = false;`
 * So the function will look like this:
 *     ```
       /**
        * Header image check
        */
       function astrid_has_header() {
         $single_toggle = false;
       	$front_header = get_theme_mod('front_header_type' ,'image');
       	$site_header = get_theme_mod('site_header_type', 'nothing');
       	global $post;
       	if ( !is_404() || !is_search() ) {
       		if ( is_singular() ) {
       	$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
       }
       	} else {
       		$single_toggle = false;
       	}
   
       	if ($single_toggle != '') {
       		return 'has-single';
       	} else {
       		if ( get_header_image() && ( $front_header == 'image' && is_front_page() ) || ( $site_header == 'image' && !is_front_page() ) ) {
       			return 'has-header';
       		} elseif ( ($front_header == 'shortcode' && is_front_page()) || ($site_header == 'shortcode' && !is_front_page()) ) {
       			return 'has-shortcode';
       		} elseif ( ($front_header == 'video' && is_front_page()) || ($site_header == 'video' && !is_front_page()) ) {
       			return 'has-video';
       		}		
       	}
       }
       ```
   
 * Hope that helps.
 * Regards,
    Kharis
 *  Thread Starter [grafis](https://wordpress.org/support/users/snackmaster/)
 * (@snackmaster)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15257717)
 * [@kharisblank](https://wordpress.org/support/users/kharisblank/) – Thank you!
   That worked perfectly!
 *  [Kharis Sulistiyono](https://wordpress.org/support/users/kharisblank/)
 * (@kharisblank)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15258282)
 * You’re welcome [@snackmaster](https://wordpress.org/support/users/snackmaster/)!
 * Please let us know in a new topic if you have any further questions, or if we
   can provide you with any other assistance.
 * Regards,
    Kharis

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP Warning Errors – functions.php line 269’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/astrid/1.20/screenshot.png)
 * Astrid
 * [Support Threads](https://wordpress.org/support/theme/astrid/)
 * [Active Topics](https://wordpress.org/support/theme/astrid/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/astrid/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/astrid/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Kharis Sulistiyono](https://wordpress.org/support/users/kharisblank/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/php-warning-errors-functions-php-line-269/#post-15258282)
 * Status: resolved