[wp-trac] [WordPress Trac] #9674: Better support for custom post types

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 1 19:41:43 UTC 2010


#9674: Better support for custom post types
------------------------------------+---------------------------------------
 Reporter:  wnorris                 |        Owner:  ryan    
     Type:  task (blessed)          |       Status:  reopened
 Priority:  normal                  |    Milestone:  3.0     
Component:  Administration          |      Version:  2.9     
 Severity:  normal                  |   Resolution:          
 Keywords:  has-patch tested early  |  
------------------------------------+---------------------------------------

Comment(by technosailor):

 Attached is a patch that fixes a problem with capability checking. When
 you register a new content type, you can set a new capability with the
 capabilities argument. Let's call it foo. The register_post_type()
 function checks against read_foo, edit_foo, delete_foo, so plugins should
 provide new caps for each of these three as needed for individual roles.

 The problem comes because of the verbage of the longstanding *_posts and
 *_pages caps. While the capabilities provided for posts and pages are
 plural, we can't change the post_types themselves (post, page). As a
 workaround, it seems that it is assumed post types are pluralized and an s
 is appended to the end of capabilities in wp-admin/post-new.php.

 The attached patch 9674_pluralcaps.diff makes this neutral allowing for
 foo or foos. This whole section of code is messier than I feel like it
 should be. There has to be a way to clean it all up and abstract things a
 bit more. Nonetheless, patch...

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9674#comment:198>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list