[wp-trac] [WordPress Trac] #29009: There should be a capability for "publish private posts"

WordPress Trac noreply at wordpress.org
Tue Dec 23 16:17:09 UTC 2014


#29009: There should be a capability for "publish private posts"
-----------------------------+-----------------------------
 Reporter:  t.schwarz        |       Owner:
     Type:  enhancement      |      Status:  reopened
 Priority:  normal           |   Milestone:
Component:  Role/Capability  |     Version:  3.9.1
 Severity:  normal           |  Resolution:
 Keywords:  dev-feedback     |     Focuses:  administration
-----------------------------+-----------------------------

Comment (by jfarthing84):

 FWIW, here's my current solution:

 {{{
 function map_publish_private_posts_to_edit_posts( $caps, $cap ) {
         global $pagenow;

         if ( 'publish_posts' == $cap && 'post.php' == $pagenow &&
                 isset( $_POST['action'] ) && 'editpost' ==
 $_POST['action'] &&
                 isset( $_POST['post_status'] ) && 'private' ==
 $_POST['post_status']
         ) {
                 $caps = array( 'edit_posts' );
         }

         return $caps;
 }
 add_filter( 'map_meta_cap', 'map_publish_private_posts_to_edit_posts', 10,
 2 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29009#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list