[wp-trac] [WordPress Trac] #28488: get_post_type_object on CPT in _count_posts_cache_key after a wp_insert_post returns null

WordPress Trac noreply at wordpress.org
Sun Jun 8 19:44:46 UTC 2014


#28488: get_post_type_object on CPT in _count_posts_cache_key after a
wp_insert_post returns null
--------------------------+-----------------------------
 Reporter:  barrykooij    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.9.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 After running a {{{wp_insert_post}}} in one of my plugins I got the
 following notices because {{{get_post_type_object}}} in
 {{{_count_posts_cache_key}}} returns null. I've added a simple not equals
 null check to the function to prevent these notices.

 Backtrace:


 {{{
 Backtrace from warning 'Trying to get property of non-object' at
 /vagrant/latest/wp-includes/post.php 2188:

 /vagrant/latest/wp-includes/post.php 5484 calling _count_posts_cache_key()
 calling _transition_post_status()
 /vagrant/latest/wp-includes/plugin.php 470 calling call_user_func_array()
 /vagrant/latest/wp-includes/post.php 3665 calling do_action()
 /vagrant/latest/wp-includes/post.php 3200 calling
 wp_transition_post_status()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-
 connection-manager-core.php 34 calling wp_insert_post()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-
 connection-manager-core.php 271 calling add()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-admin-
 menu.php 117 calling save()
 calling handle_post()
 /vagrant/latest/wp-includes/plugin.php 470 calling call_user_func_array()
 /vagrant/latest/wp-admin/admin.php 144 calling do_action()

 Backtrace from warning 'Trying to get property of non-object' at
 /vagrant/latest/wp-includes/post.php 2188:

 /vagrant/latest/wp-includes/post.php 5484 calling _count_posts_cache_key()
 calling _transition_post_status()
 /vagrant/latest/wp-includes/plugin.php 470 calling call_user_func_array()
 /vagrant/latest/wp-includes/post.php 3665 calling do_action()
 /vagrant/latest/wp-includes/post.php 3200 calling
 wp_transition_post_status()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-
 connection-manager-core.php 34 calling wp_insert_post()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-
 connection-manager-core.php 271 calling add()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-admin-
 menu.php 117 calling save()
 calling handle_post()
 /vagrant/latest/wp-includes/plugin.php 470 calling call_user_func_array()
 /vagrant/latest/wp-admin/admin.php 144 calling do_action()

 Backtrace from warning 'Cannot modify header information - headers already
 sent' at /vagrant/latest/wp-includes/pluggable.php 1121:

 /vagrant/latest/wp-includes/pluggable.php 1121 calling header()
 /vagrant/latest/wp-content/plugins/my-plugin/core/classes/class-admin-
 menu.php 119 calling wp_redirect()
 calling handle_post()
 /vagrant/latest/wp-includes/plugin.php 470 calling call_user_func_array()
 /vagrant/latest/wp-admin/admin.php 144 calling do_action()
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28488>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list