Title: PHP warnings when create post
Last modified: August 21, 2016

---

# PHP warnings when create post

 *  [aurepons](https://wordpress.org/support/users/aurepons/)
 * (@aurepons)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/php-warnings-when-create-post/)
 * When creating a new post with Posts Conroller, some warnings are shown when php
   errors are enabled.
 * I have discovered this is because global $post variable is not defined when you
   call setup_postdata at import_wp_object function of post model object (./models/
   post.php about line 134)
 * If you add next code before this line, problem is solved, but maybe you can find
   more elegant solution.
 * global $post; $post=$wp_post;
 * Thank you
 * [http://wordpress.org/plugins/json-api/](http://wordpress.org/plugins/json-api/)

The topic ‘PHP warnings when create post’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

## Tags

 * [php warnings](https://wordpress.org/support/topic-tag/php-warnings/)

 * 0 replies
 * 1 participant
 * Last reply from: [aurepons](https://wordpress.org/support/users/aurepons/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/php-warnings-when-create-post/)
 * Status: not resolved