Title: PHP Warning: property &#8220;post_type&#8221; on null
Last modified: May 12, 2025

---

# PHP Warning: property “post_type” on null

 *  [Gevorg](https://wordpress.org/support/users/gev0rg/)
 * (@gev0rg)
 * [1 year ago](https://wordpress.org/support/topic/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:
 *     ```wp-block-code
       return ( $screen->post_type == SC_POST_TYPE && $screen->base == 'post' );
       ```
   
 * It happens when the variable `$screen` happens to be `null`. Then `$screen->post_type`
   can not be accessed and therefore the `return` statement itself fails.
 * To mitigate the problem I made the following change in your code:
 *     ```wp-block-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

Viewing 1 replies (of 1 total)

 *  Plugin Author [vaakash](https://wordpress.org/support/users/vaakash/)
 * (@vaakash)
 * [1 year ago](https://wordpress.org/support/topic/php-warning-property-post_type-on-null/#post-18465956)
 * Hi Gevorg,
 * Thanks for reporting this issue. This will be fixed in the next release of the
   plugin.
 * Thanks,
 * Aakash

Viewing 1 replies (of 1 total)

The topic ‘PHP Warning: property “post_type” on null’ is closed to new replies.

 * ![](https://ps.w.org/shortcoder/assets/icon.svg?rev=2222236)
 * [Shortcoder — Create Shortcodes for Anything](https://wordpress.org/plugins/shortcoder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcoder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcoder/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcoder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcoder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcoder/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [vaakash](https://wordpress.org/support/users/vaakash/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/php-warning-property-post_type-on-null/#post-18465956)
 * Status: not resolved