#2591
James Wee
Participant

Yes, but I have granted all privilege (including create_{posttype} ) for the post type “news” and “events”.

And with this submenu setup alone it will not allow me to create news and events.


 $submenu_pages = array(
    array(
      'parent_slug'   => 'edit.php?post_type=news',
      'page_title'    => 'All News',
      'menu_title'    => 'All News',
      'capability'    => 'edit_newss',
      'menu_slug'     => 'edit.php?post_type=news',
      'function'      => null,// Uses the same callback function as parent menu. 
    ),
    array(
      'parent_slug'   => 'edit.php?post_type=news',
      'page_title'    => 'All Events',
      'menu_title'    => 'All Events',
      'capability'    => 'edit_eventss',
      'menu_slug'     => 'edit.php?post_type=events',
      'function'      => null,// Uses the same callback function as parent menu. 
    ),
  )

I have to do something like this in order to enable create_{posttype} for the users. Why is that so?


  $submenu_pages = array(
    //edit.php 
    array(
      'parent_slug'   => 'edit.php?post_type=news',
      'page_title'    => 'All News',
      'menu_title'    => 'All News',
      'capability'    => 'edit_newss',
      'menu_slug'     => 'edit.php?post_type=news',
      'function'      => null,// Uses the same callback function as parent menu. 
    ),
    array(
      'parent_slug'   => 'edit.php?post_type=news',
      'page_title'    => 'All Events',
      'menu_title'    => 'All Events',
      'capability'    => 'edit_eventss',
      'menu_slug'     => 'edit.php?post_type=events',
      'function'      => null,// Uses the same callback function as parent menu. 
    ),
    //post-new.php HIDDEN
    array(
      'parent_slug'   => 'null', //Don't display on menu
      'page_title'    => 'Add News',
      'menu_title'    => 'Add News',
      'capability'    => 'create_newss',
      'menu_slug'     => 'post-new.php?post_type=news',
      'function'      => null,// Uses the same callback function as parent menu. 
    ),
    array(
      'parent_slug'   => 'null', //Don't display on menu
      'page_title'    => 'Add Events',
      'menu_title'    => 'Add Events',
      'capability'    => 'create_eventss',
      'menu_slug'     => 'post-new.php?post_type=events',
      'function'      => null,// Uses the same callback function as parent menu. 
    ),
  )