Add highlighting to new Admin Dashboard Menu Item

The probability is high that no hook will exist for that… But it can be solved with jQuery: add_action( ‘admin_head-post.php’, ‘wpse_58567_highlight_menu_item’ ); function wpse_58567_highlight_menu_item() { global $post; if( 69 != $post->ID ) return; ?> <script type=”text/javascript”> jQuery(document).ready( function($) { $(‘#toplevel_page_post-post-69-action-edit’).removeClass(‘wp-not-current-submenu’).addClass(‘current’); $(‘#toplevel_page_post-post-69-action-edit’).find(‘a:last’).addClass(‘current’); }); </script> <?php }

Generate Advanced Custom Fields box in custom admin menu page

Interesting exercise, a one page plugin that believes it deserves a first level menu page is wrong, IMO. I use the same technique with Jetpack. To create sub-pages in the Options Page add-on, read the documentation. The logic of this menu/sub-menu swapping is: Add multiple ACF Options Pages Create our menu first level page Remove … Read more

The seventh parameter passed to add_submenu_page()

I was able to track this down to the culprit function add_theme_page(). There There was an additional parameter, per the codex for add_theme_page() that needed to be removed. Removing that seemed to help. function fivehundred_register_admin_menu() { add_theme_page( ‘500 Settings’, ‘500 Settings’, ‘manage_options’, ‘theme-settings’, ‘fivehundred_admin_menu’, plugins_url( ‘/ignitiondeck/images/ignitiondeck-menu.png’ ) ); } add_action( ‘admin_menu’, ‘fivehundred_register_admin_menu’ ); Fixed code … Read more

What is the use of $page_title and how to use it?

Ok my bad found the answer on the codex page but at the very bottom so I’m adding this here as well so if anyone like my didn’t catch it on WordPress’s codex, they can find it here 🙂 Just use get_admin_page_title(); See the example 1 below: function register_my_custom_submenu_page() { add_submenu_page( ‘tools.php’, ‘My Custom Submenu … Read more

How to use a WordPress’ existing admin icon?

add_menu_page(); as far as I can tell does not work with screen_icon or the default CSS parameters. The $icon paramater only takes 2 options, an url or div (well 3 if you leave it empty), so that leaves you with these options: Hard-code the link to the icons which are located in wp-includes/images/wpicons.png. This is … Read more

add_submenu_page not working

Make sure that your add_action hook is set to admin_menu. Here’s a sample code: add_action(‘admin_menu’, ‘wpse149688’); function wpse149688(){ add_menu_page( ‘Wholesale Pricing’, ‘Wholesale’, ‘manage_options’, ‘woo-wholesale’, ‘woo_wholesale_page_call’); add_submenu_page( ‘woo-wholesale’, ‘Registrations’, ‘Registrations’, ‘manage_options’, ‘woo-wholesale-registrations’, ‘wwpr_page_call’ ); } Also check whether user you’ve logged in as has the ability to view this menu. As this menu is set using … Read more

Add custom page link with anchor

I was searching for an answer for this but suddenly I got the idea and it works! In the menu settings just add the anchor link just like an html link code <a href=”#anchor” >titulo </a> So with WP is the same but only adding the anchor in the field link This will create the … Read more

add_menu_page permissions – what am I doing wrong?

You want the admin_menu hook, rather than admin_init. Also, you shouldn’t use anonymous functions. Instead, use: function wpse51004_add_menu_page() { add_menu_page(‘Some Page’, ‘Some Page’, ‘manage_options’, ‘some-slug’, ‘wpse51004_some_page_callback’); }; add_action(‘admin_menu’, ‘wpse51004_add_menu_page’); function wpse51004_some_page_callback() { echo ‘Hello, world!’; }

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