Title: php error em_posts.php =&gt; function em_map_meta_cap
Last modified: November 2, 2017

---

# php error em_posts.php => function em_map_meta_cap

 *  Resolved [cappellania.uniroma3](https://wordpress.org/support/users/cappellaniauniroma3/)
 * (@cappellaniauniroma3)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/php-error-em_posts-php-function-em_map_meta_cap/)
 * I noticed an error while editing event posts “cannot read property of non-object
   in em_posts.php at line 327”.
 * So I investigated what was at line 327. It’s in the “em_map_meta_cap” function,
   and the $post_type object seemed to be acting a bit quirky. I tried to do some
   direct output to see what was happening and why it was giving a non-object error.
   It turns out this function is being called twice, because I’m seeing two outputs,
   the first time round the $post_type variable is an object but the second time
   around the $post_type variable is null.
 * Seeing that the $post_type variable is being populated based on the $args[0] 
   variable (which should contain the post id), I tried dumping that too. And it
   is in fact being called twice, the first time it is correctly outputting the 
   post id of the event being edited (in this case “1125”), whereas the second time
   it is outputting “1127” and therefore no longer corresponds with the event being
   edited and goes into error when testing for event_owner…
 * Why is this function being called twice? And what argument is being passed the
   second time around seeing that it no longer corresponds with the correct event
   post id?

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

 *  Thread Starter [cappellania.uniroma3](https://wordpress.org/support/users/cappellaniauniroma3/)
 * (@cappellaniauniroma3)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/php-error-em_posts-php-function-em_map_meta_cap/#post-9645271)
 * Just to follow up on this, I was getting this double output while there was a
   notification of a more recent automatic save of the event post. After updating
   the event post, the more recent automatic save disappeared and there was no more
   double call to the “em_map_meta_cap” function. I believe the “more recent automatic
   save” is not being taken into account somewhere in the code…
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/php-error-em_posts-php-function-em_map_meta_cap/#post-9648728)
 * Which version of Events Manager and WordPress are you using?

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

The topic ‘php error em_posts.php => function em_map_meta_cap’ is closed to new 
replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

## Tags

 * [non object](https://wordpress.org/support/topic-tag/non-object/)
 * [Property](https://wordpress.org/support/topic-tag/property/)

 * 2 replies
 * 2 participants
 * Last reply from: [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/php-error-em_posts-php-function-em_map_meta_cap/#post-9648728)
 * Status: resolved