Hooking into add_submenu_page

Hook into admin_head, the last action before the menu is rendered, and change the global $menu: add_action( ‘admin_head’, ‘wpse_71303_change_menu_cap’ ); /** * Change the capability to access an admin menu item. * * @wp-hook admin_head * @return void */ function wpse_71303_change_menu_cap() { global $menu; foreach ( $menu as $key => $item ) { // Find … Read more

Add a banner to the Dashboard

Workaround using jQuery DOM insertion. Note the use of PHP Heredoc sintax to print the script. function wpse_53035_script_enqueuer(){ echo <<<HTML <script type=”text/javascript”> jQuery(document).ready( function($) { $(‘<div style=”width:100%;text-align:center;”><img src=”http://cdn.sstatic.net/wordpress/img/logo.png?v=123″></div>’).insertBefore(‘#welcome-panel’); }); </script> HTML; } add_action(‘admin_head-index.php’, ‘wpse_53035_script_enqueuer’); This inserts the new div at the top before #welcome-panel. If you use the div #dashboard-widgets-wrap it prints in the same … Read more

Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php

Every string goes through translate(), which uses the gettext filter. This mean you can try something like this: add_filter( ‘gettext’, ‘wpse6096_gettext’, 10, 2 ); function wpse6096_gettext( $translation, $original ) { if ( ‘Nickname’ == $original ) { return ‘Funny name’; } if ( ‘Biographical Info’ == $original ) { return ‘Resume’; } return $translation; } … Read more

How do I create a section in the dashboard w/ an input field

This is pretty easy to do with the Dashboard Widgets API http://codex.wordpress.org/Dashboard_Widgets_API. Here are the steps I would take to create this: Queue up a jQuery script for AJAX handling Create a PHP AJAX function and corresponding AJAX hook for saving the form data Create the dashboard widget with HTML form input(s) Here’s a sample … Read more

Removing admin bar from wordpress dashboard

if (!function_exists(‘disableAdminBar’)) { function disableAdminBar(){ remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 ); function remove_admin_bar_style_backend() { echo ‘<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>’; } add_filter(‘admin_head’,’remove_admin_bar_style_backend’); } } add_filter(‘admin_head’,’remove_admin_bar_style_backend’); Source: http://wp.tutsplus.com/tutorials/how-to-disable-the-admin-bar-in-wordpress-3-3/ OR, for both front and back end… if (!function_exists(‘disableAdminBar’)) { function disableAdminBar(){ remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 ); // for the admin page remove_action( ‘wp_footer’, ‘wp_admin_bar_render’, … Read more

How to develop a community feature in the dashboard for multiauthor site

What I do for almost every site with multiple authors: Create a separate blog for meta discussions, for example meta.example.com. Use P2 as theme. Install Authenticator to allow access for members only. Install something like Inform about Content, so the members get an email whenever something new was posted. I probably wouldn’t do that for … Read more

Remove a plugin meta box from the dashboard

I found that this works: add_action(‘admin_init’, ‘rw_remove_dashboard_widgets’); function rw_remove_dashboard_widgets() { remove_meta_box(‘wpdm_dashboard_widget’, ‘dashboard’, ‘normal’); } I guess ‘admin_init’ is the key, so that it runs before the dashboard is loaded.

Hiding certain panels in dashboard

@joesk isn’t quite correct. If you simply want to hide a meta box or two on the post-editing screen, you can do that via the Screen Options tab at the top of most screens. If it’s not aesthetic to your personal preferences and you’d like to remove the ability to edit the Excerpt at all, … Read more