Admin Menus – Name Menu different from first Submenu [duplicate]

The first menu item typically is the parent item and shares the name with that item, you can however manually update the entry directly in the $submenu variable, like so.. add_action( ‘admin_menu’, ‘jp_create_admin_pages’ ); function jp_create_admin_pages() { global $submenu; add_menu_page(‘Members’,’Members’,’manage_options’,’members’,’jp_handle_admin_members’); add_submenu_page(‘members’,’Membership Types’,’Membership Types’,’manage_options’,’membership_types’,’jp_handle_admin_membership_types’); $submenu[‘members’][0][0] = ‘All Members’; } That way your parent keeps the original … Read more

Retrieve and display data from custom db table in admin area?

Working code for adding widget to wp dashboard with information from custom DB: /** * Add application widget to the dashboard. */ function addApplicationWidget() { wp_add_dashboard_widget( ‘submitted_applications’, ‘Submitted Applications’, ‘showApplicants’ ); } add_action( ‘wp_dashboard_setup’, ‘addApplicationWidget’ ); function showApplicants() { global $wpdb; $appTable = $wpdb->prefix . “applications”; $query = $wpdb->prepare(“SELECT * FROM $appTable WHERE %d >= … Read more

How can I get an array/list of all current WordPress Admin Menu items?

<?php if (!function_exists(‘debug_admin_menus’)): function debug_admin_menus() { global $submenu, $menu, $pagenow; if ( current_user_can(‘manage_options’) ) { // ONLY DO THIS FOR ADMIN if( $pagenow == ‘index.php’ ) { // PRINTS ON DASHBOARD echo ‘<pre>’; print_r( $menu ); echo ‘</pre>’; // TOP LEVEL MENUS echo ‘<pre>’; print_r( $submenu ); echo ‘</pre>’; // SUBMENUS } } } add_action( … Read more

remove_meta_box for all post types doesn’t seem to work

Remember Apple’s “Goto Fail”? Similar situation: Your code actually does this, when indentation is corrected: foreach ( $post_types as $post_type ) remove_meta_box(‘trackbacksdiv’, $post_type, ‘normal’); remove_meta_box(‘postcustom’, $post_type, ‘normal’); remove_meta_box(‘authordiv’, $post_type, ‘normal’); remove_meta_box(‘postexcerpt’, $post_type, ‘normal’); So, it should does the job for trackbacksdiv, but not for the rest because the function calls are outside of the foreach … Read more

How to prevent parent admin page from appearring as a child admin page

Unless I misunderstand the question, this should do the trick: add_action(‘admin_menu’, ‘add_menu_pages’); function add_menu_pages() { add_menu_page(‘Menu Title’, ‘Menu Title’, 10, ‘main_menu’, ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 1’, ‘Sub Menu Title 1’, 10, ‘main_menu’ , ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 2’, ‘Sub Menu Title 2’, 10, ‘sub_menu’ , ‘submenu_2_callback’); } function submenu_1_callback() { echo “<h2>” . … Read more

wp_verify_nonce() why return false?

Revised code if(is_admin()) { add_action(‘admin_menu’, ‘awesome_page_create’); function awesome_page_create() { $page_title=”My Awesome Admin Page”; $menu_title=”Awesome Admin Page”; $capability = ‘edit_posts’; $menu_slug = ‘awesome_page’; $function = ‘my_awesome_page_display’; $icon_url=””; $position = 24; add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position); } function my_awesome_page_display() { if (!current_user_can(‘manage_options’)) { wp_die(‘Unauthorized user’); } $value = get_option(‘awesome_text’, ”); ?> <h1>My Awesome Settings Page</h1> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)