[wp-trac] [WordPress Trac] #28215: Admin CPT comments error
WordPress Trac
noreply at wordpress.org
Mon May 12 11:22:11 UTC 2014
#28215: Admin CPT comments error
----------------------------+-----------------------------
Reporter: dgwyer | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
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:
1. Activate Plugin (below) to enable the CPT.
2. Create a new 'Testimonial' and publish it to be able to leave a comment
directly on the post edit screen.
3. View the comment on 'Dashboard' and 'Comments' admin pages (no visible
errors).
4. 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' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28215>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list