and custom post_types to custom menu

Try adding the action after the function like this: function mt_add_pages() { // Add theme options page to the addmin menu add_menu_page(__(‘Competition’,’comp’), __(‘Competition’,’comp’), ‘manage_options’, ‘mt-top-level-handle’, ‘test_func’, ”, 5 ); add_submenu_page(‘mt-top-level-handle’, __(‘Answers’,’comp-answers’), __(‘Answers’,’comp-answers’), ‘manage_options’, ‘sub-page’, ‘test_func2’); } add_action( ‘admin_menu’, ‘mt_add_pages’ );

Add Admin menus or submenus depending on conditions

I managed to find a solution: File 1: //Count the number of active plugins whose Author is “My Brand”, and store the number in a global variable. $GLOBALS[‘mybrand_active_plugins’]=0; if (!function_exists(‘get_plugins’)){require_once ABSPATH.’wp-admin/includes/plugin.php’;} $plugins=get_plugins(); $activated_plugins=get_option(‘active_plugins’); foreach ($activated_plugins as $p){ if( (isset($plugins[$p])) AND ($plugins[$p][‘Author’]==’My Brand’)){ $GLOBALS[‘mybrand_active_plugins’]++; } } // Add menus on sidebar if($GLOBALS[‘mybrand_active_plugins’]<2) { function sub1_setup_menu() { … Read more

How to add a menu page for options in wordpress for user that has the role of vendor?

The third argument to add_menu_page() is $capability. add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); That governs who can see the page. You’ve registered yours as “administrator”, which is a user role. Presumably your vendors are not of that role. To fix this, you will need to change that argument to a capability (preferably … Read more