[wp-hackers] register_post_type not completing with capability_type set to custom value

Tom Barrett tcbarrett at gmail.com
Tue Oct 30 16:55:49 UTC 2012

I have something like this in my dev for adding caps to users as I update
and change things:

$cpt_caps = array( 'edit_post', 'read_post', 'delete_post', 'edit_posts',
'edit_others_posts', 'publish_posts', 'read_private_posts' );
$admin    = &get_role( 'administrator' );
$mycpts   = array( 'adc_pfinder' );
foreach( $mycpts as $cptslug ) :
  $cpt  = get_post_type_object( $cptslug );
  foreach( $cpt_caps as $cap ) :
    $admin->add_cap( $cpt->cap->$cap );

(off the top of my head, may contain syntax errors)

http://www.tcbarrett.com | http://gplus.to/tcbarrett |

More information about the wp-hackers mailing list