Created a brand new position (price_admin
) with the next code and added capabilities. The menu merchandise appeared, however clicking it exhibits "you are not authorized to access this page".
perform ui_new_role() {
add_role('price_admin',
'Value Calculator Admin',
array(
'learn' => true,
'edit_posts' => true,
'delete_posts' => true,
'publish_posts' => true,
'upload_files' => true,
)
);
$roles = array('price_admin','editor','administrator');
foreach($roles as $the_role) {
$position = get_role($the_role);
$role->add_cap( 'learn' );
$role->add_cap( 'read_price');
$role->add_cap( 'edit_price' );
$role->add_cap( 'edit_prices' );
$role->add_cap( 'edit_others_prices' );
$role->add_cap( 'edit_published_prices' );
$role->add_cap( 'publish_prices' );
}
}
add_action('admin_init', 'ui_new_role');
My register_post_type
code is:
register_post_type(
'worth',
array(
'labels' => array('identify' => 'Remedy Questions'),
'capability_type' => array('worth','costs'),
'map_meta_cap' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => 'my-menu',
'menu_position' => 15,
'helps' => array('title'),
'taxonomies' => array('location'),
'has_archive' => true,
)
);
Edit:
I take advantage of add_menu_page
;
add_menu_page('My Web page Title', 'Value Calculator', 'manage_options', 'my-menu', 'show_price', 'dashicons-calculator', '13');
That is the way it seems like for my new consumer; (Can’t entry each subpages.)