Title: Undefined property: stdClass::$edit_published_posts
Last modified: August 20, 2016

---

# Undefined property: stdClass::$edit_published_posts

 *  Resolved [Phil](https://wordpress.org/support/users/philnelsonweb/)
 * (@philnelsonweb)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/undefined-property-stdclassedit_published_posts/)
 * When I have a custom post type without the ‘edit_published_posts’ capability 
   defined, I get a php notice (in debug mode) when viewing the edit posts admin
   page for that post type: “Notice: Undefined property: stdClass::$edit_published_posts.”
   Not a huge issue. I’m just reporting it, and happy to have feedback for a better
   resolution than below. Here’s my setup.
    - WP debug mode
    - Co-Authors Plus 3.0.2
    - Twenty Eleven 1.4
    - WP 3.4.2
    - no other plugins
 * Some code to replicate the problem:
 *     ```
       // in wp-config.php: define('WP_DEBUG', true);
   
       add_action( 'init', 'sample_cpt' );
       function sample_cpt() {
   
       	// Register New Post Type
       	$args = array(
       		'public' => true,
       		'label' => 'Events',
       		'supports' => array('title', 'editor', 'page-attributes'),
       		'capabilities' => array(
       			'edit_post' => 'edit_event',
       			'read_post' => 'read_event',
       			'delete_post' => 'delete_event',
       			// etc.
       			//'edit_published_posts' => 'edit_published_events'
       		)
       	);
       	register_post_type( 'events', $args );
   
       	// normally might add_cap() to roles here
   
       	// Create example post
       	$example_post_exists = get_page_by_title('example post', 'object', 'events');
       	if ( !$example_post_exists ) {
       		$example_post = array(
       			'post_content' => 'example post content',
       			'post_status' => 'publish',
       			'post_title' => 'example post',
       			'post_type' => 'events'
       		);
       		wp_insert_post($example_post);
       	}
       }
   
       // Go view php notice on admin edit posts page for new Events cpt
       ```
   
 * As expected, the notice does not display if you uncomment the `'edit_published_posts'
   => 'edit_published_events'` in the ‘capabilities’ code above. I think the capability`'
   edit_published_posts'` would normally be set by default, unless omitted in an
   explicit declaration of the capabilities, like my example above. I’ve come across
   a plugin for which this was the case.
 * To get rid of the notice, I’ve altered the file co-authors-plus.php on line 1075
 * > `if ( 'publish' == get_post_status( $post_id ) /*&& ! empty( $obj->cap->edit_published_posts)*/&&!
   > empty( $current_user->allcaps[$obj->cap->edit_published_posts] ) )`
 * I added the conditional inside the commented section (/*conditional*/). Uncomment
   it and the notice no longer displays. The same thing could probably be done on
   line 1077.
 * Feedback welcome. Thanks for a great plugin!
 * [http://wordpress.org/extend/plugins/co-authors-plus/](http://wordpress.org/extend/plugins/co-authors-plus/)

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

 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/undefined-property-stdclassedit_published_posts/#post-3227704)
 * This seems reasonable. Want to submit a pull request for it?
 *  [nickdaugherty](https://wordpress.org/support/users/nickdaugherty/)
 * (@nickdaugherty)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/undefined-property-stdclassedit_published_posts/#post-3227718)
 * This has been resolved in the latest code on GitHub.

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

The topic ‘Undefined property: stdClass::$edit_published_posts’ is closed to new
replies.

 * ![](https://ps.w.org/co-authors-plus/assets/icon-256x256.png?rev=2945095)
 * [Co-Authors Plus](https://wordpress.org/plugins/co-authors-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/co-authors-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/co-authors-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/co-authors-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/co-authors-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/co-authors-plus/reviews/)

## Tags

 * [edit_published_posts](https://wordpress.org/support/topic-tag/edit_published_posts/)
 * [PHP Notice](https://wordpress.org/support/topic-tag/php-notice/)
 * [Undefined property](https://wordpress.org/support/topic-tag/undefined-property/)

 * 2 replies
 * 3 participants
 * Last reply from: [nickdaugherty](https://wordpress.org/support/users/nickdaugherty/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/undefined-property-stdclassedit_published_posts/#post-3227718)
 * Status: resolved