admin/mf_posttype.php
public function _add_cap($name){

    $caps = array(
      'publish_posts'      => sprintf('publish_%ss',$name),
      'edit_posts'         => sprintf('edit_%ss',$name),
      'edit_others_posts'  => sprintf('edit_others_%ss',$name),
      'read_private_posts' => sprintf('read_private_%ss',$name),
      'edit_post'          => sprintf('edit_%s',$name),
      'delete_post'        => sprintf('delete_%s',$name),
      'read_post'          => sprintf('read_%s',$name)
    );
    $role = get_role('administrator');

    if( !in_array($caps['edit_post'],array_keys($role->capabilities)) ){
      foreach($caps as $cap){
        $role->add_cap($cap);
      }
    }

  }
public function _add_cap($name){

    $caps = array(
      'publish_posts'      => sprintf('publish_%ss',$name),
      'edit_posts'         => sprintf('edit_%ss',$name),
      'edit_others_posts'  => sprintf('edit_others_%ss',$name),
      'read_private_posts' => sprintf('read_private_%ss',$name),
      'edit_post'          => sprintf('edit_%s',$name),
      'delete_post'        => sprintf('delete_%s',$name),
      'read_post'          => sprintf('read_%s',$name)
    );
    $role = get_role('administrator');

    if( !in_array($caps['edit_post'],array_keys($role->capabilities)) ){
      foreach($caps as $cap){
        $role->add_cap($cap);
      }
    }

  }
public function _add_cap ( $ name ) { $ caps = array ( 'publish_posts' => sprintf ( 'publish_%ss' , $ name ) , 'edit_posts' => sprintf ( 'edit_%ss' , $ name ) , 'edit_others_posts' => sprintf ( 'edit_others_%ss' , $ name ) , 'read_private_posts' => sprintf ( 'read_private_%ss' , $ name ) , 'edit_post' => sprintf ( 'edit_%s' , $ name ) , 'delete_post' => sprintf ( 'delete_%s' , $ name ) , 'read_post' => sprintf ( 'read_%s' , $ name ) ) ; $ role = get_role ( 'administrator' ) ; if ( ! in_array ( $ caps [ 'edit_post' ] , array_keys ( $ role -> capabilities ) ) ) { foreach ( $ caps as $ cap ) { $ role -> add_cap ( $ cap ) ; } } }
Add a news Capabilities for Administrator
Add a news Capabilities for Administrator