Title: Unexpected error
Last modified: November 8, 2021

---

# Unexpected error

 *  Resolved [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/)
 * [https://drive.google.com/file/d/1Dndblz0tVwMXye1rePrOmCD46TEOueLk/view?usp=sharing](https://drive.google.com/file/d/1Dndblz0tVwMXye1rePrOmCD46TEOueLk/view?usp=sharing)
 * Why I get this error? 🙂

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

 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15049361)
 * Hello.
 * This error occurs in the code of your snippet.
 *  Thread Starter [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15065969)
 * I don’t use property post_type in my snippets. Maybe it is a conflict with the
   theme…
 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15067915)
 * Are you using the latest version of the plugin?
    Can you show in the screenshot
   what you have in this file on line 80?
 *  Thread Starter [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15070495)
 * In line 80 I have this line:
    $post_type = ! empty( $post ) ? $post->post_type:
   get_post( $data->ID )->post_type;
 * I don’t use the last version of the plugin and I cannot update because I use 
   a version with my own customizations and I have done this post in order to help
   you.
 * I love your plugin and it would be my pleasure to contribute =D
 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15071952)
 * We cannot support a customized version of the plugin for you. You’ll have to 
   figure it out yourself.
 *  Thread Starter [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15090727)
 * In line 80 I have this line:
    $post_type = ! empty( $post ) ? $post->post_type:
   get_post( $data->ID )->post_type;
 * The problem in this line was that $post could be an integer=post_id, so the so
   simple fix is this:
    $post_type = ! empty( $post ) && is_object($post) ? $post-
   >post_type : get_post( $data->ID )->post_type;

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

 The topic ‘Unexpected error’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/unexpected-error-36/#post-15090727)
 * Status: resolved