• ResolvedModerator cubecolour

    (@numeeja)


    I’m developing a site locally and I see an error on some admin pages when WP_DEBUG is on:

    Notice: Trying to get property of non-object in /Users/dev/sites/local.dev/wp-content/plugins/am-events/am-events.php on line 292

    I made a quick fix to the plugin on my installation to prevent this notice appearing by changing the first few lines in the am_custom_script_post function:

    original:

    
    	global $post;
    	if ($post->post_type !== 'am_event' || !is_admin()) {
    		return;
    	}
    

    changed to:

    
    	global $pagenow;
    	global $post;
    
    	if ( !is_admin() || $pagenow !== 'post.php' || $post->post_type !== 'am_event' ) {
    		return;
    	}
    
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP_DEBUG notice in some admin pages’ is closed to new replies.