Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#28215 closed defect (bug) (duplicate)

Admin CPT comments error

Reported by: dgwyer's profile 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:

  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' );

Change History (3)

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16956.

#2 @SergeyBiryukov
11 years ago

  • Component changed from Administration to Posts, Post Types
  • Focuses administration added

#3 @dgwyer
11 years ago

Why has status been set to closed, and milestone to not awaiting review?

*Update* Didn't see duplicate notice.

Last edited 11 years ago by dgwyer (previous) (diff)
Note: See TracTickets for help on using tickets.