#28215 closed defect (bug) (duplicate)
Admin CPT comments error
Reported by: | dgwyer | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | administration | Cc: |
Description
I'm seeing errors on the 'Dashboard', and 'Comments' admin pages when a CPT that supports comments has been deactivated (e.g. via a Plugin).
Reported error messages are:
Notice: Trying to get property of non-object in C:\wamp\www\wp\wp-includes\capabilities.php on line 1154 Notice: Trying to get property of non-object in C:\wamp\www\wp\wp-includes\capabilities.php on line 1155
Here is an example Plugin with steps to replicate the issue:
- Activate Plugin (below) to enable the CPT.
- Create a new 'Testimonial' and publish it to be able to leave a comment directly on the post edit screen.
- View the comment on 'Dashboard' and 'Comments' admin pages (no visible errors).
- Deactivate the Plugin and view 'Dashboard' and 'Comments' admin pages again. Errors are visible this time.
<?php /* Plugin Name: CPT comments error example */ function reg_cpt() { $args = array( 'public' => true, 'supports' => array( 'title', 'comments' ), 'labels' => array( 'name' => 'Testimonials' ) ); register_post_type( 'tml', $args ); } add_action( 'init', 'reg_cpt' );
Change History (3)
Note: See
TracTickets for help on using
tickets.
Duplicate of #16956.