PHP Warning: property “post_type” on null
-
Hello
I would like to draw your attention to a PHP warning that occurs in your plugin called Shortcoder. The PHP warning is caused in the file
/shortcoder/admin/tools.php, on line 54.This line of code causes the PHP warning:
return ( $screen->post_type == SC_POST_TYPE && $screen->base == 'post' );It happens when the variable
$screenhappens to benull. Then$screen->post_typecan not be accessed and therefore thereturnstatement itself fails.To mitigate the problem I made the following change in your code:
if ( null !== $screen )
return ( $screen->post_type == SC_POST_TYPE && $screen->base == 'post' );
else
return null;You can make whatever adjustment you think is best in this case for your code. I am just trying to direct your attention to this issue.
Sincerely,
Gevorg
The topic ‘PHP Warning: property “post_type” on null’ is closed to new replies.