Add Copy to the Add New Tag (or other Taxonomy) Page

Maybe you need to add some extra text to the page to explain to a user why they should take a minute to spellcheck their new category or tag. Or perhaps you want to want to encourage them to check if a certain category already exists as a plural or singular from. You can add this extra copy in at least 2 places on the various taxonomy admin pages.

add_action( 'after-' . 'category' . '-table', 'copy_below_table' );
function copy_below_table( $taxonomy ) {
    echo '<p>Lorem ipsum</p>';
}

add_action( 'category' . '_pre_add_form', 'copy_above_form' );
function copy_above_form( $taxonomy ) {
    echo '<p>Dolor sit amet</p>';
}

Remove Categories Meta Box

Sometimes, the ability to add multiple categories to a single post can cause problems. Or maybe you’re working with custom taxonomies and you need to make sure only one term is assigned to a post. Assuming you’re creating your own alternative category selection box, you can use this to get red of the default meta box.

add_action('admin_init','remove_cat_box');
function remove_cat_box() {
    //args: $categoryslug.'div', $posttype, $location
    remove_meta_box('categorydiv', 'post', 'side');
}

Add Extra Content to the Widgets Admin

I don’t have a good example of why you might want or need this, but nevertheless, if you should want to add additional text to the Widgets admin, it’s pretty darn easy:

add_action( 'widgets_admin_page', 'widgets_admin_info' );
function widgets_admin_info() {
    ?>
    <p style="clear:both;">Hello there!!</p>
    <?php
}

Hide Admin Bar

If you’re one of those that don’t love the admin bar, here’s how to disable it, as well as the option to show/hide it.

add_filter('show_admin_bar', '__return_false');
add_action( 'admin_print_scripts-profile.php', 'hide_admin_bar_prefs' );
function hide_admin_bar_prefs() {
    ?><style type="text/css">.show-admin-bar {display:none;}</style><?php 
}

Add New Dashboard Widget

Add a new widget to the dashboard. Note, this will add the widget to the bottom of the page. If you want to try to move it to the top, check out the Codex page about dashboard widgets

add_action('wp_dashboard_setup', 'add_custom_dash_boxes');
function add_custom_dash_boxes() {
    wp_add_dashboard_widget( 
        'welcome_box',
        __( 'Welcome', 'myplugin_textdomain' ),
        'welcome_box_text'
    );
}
function welcome_box_text() {
    echo 'Custom welcome text here';
}

Remove Unwanted Dashboard Widgets

If you feel your dashboard is too cluttered, you can use this to remove any or all of the widgets

add_action( 'wp_dashboard_setup', 'remove_wp_dashboard_widgets' );
function remove_wp_dashboard_widgets() {
	//Plugins
	wp_unregister_sidebar_widget( 'dashboard_plugins' );
	remove_meta_box('dashboard_plugins', 'dashboard', 'normal');

	//Right Now
	//wp_unregister_sidebar_widget( 'dashboard_right_now' );
	//remove_meta_box('dashboard_right_now', 'dashboard', 'normal');

	//Recent Comments
	//wp_unregister_sidebar_widget( 'dashboard_recent_comments' );
	//remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');

	//Incoming Links
	//wp_unregister_sidebar_widget( 'dashboard_incoming_links' );
	//remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');

	//WordPress Blog
	wp_unregister_sidebar_widget( 'dashboard_primary' );
	remove_meta_box('dashboard_primary', 'dashboard', 'side');

	//Other WordPress News
	wp_unregister_sidebar_widget( 'dashboard_secondary' ); 
	remove_meta_box('dashboard_secondary', 'dashboard', 'side');

	//Quick Press
	//wp_unregister_sidebar_widget( 'dashboard_quick_press' ); 
	//remove_meta_box('dashboard_quick_press', 'dashboard', 'side');

	//Recent Drafts
	//wp_unregister_sidebar_widget( 'dashboard_recent_drafts' ); 
	//remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
}

Add A Security Question to the Register Screen

Want to allow people to register on your site, but don’t want to be flooded with spam users? Try this:

add_action( 'register_form', 'add_register_field' );
function add_register_field() { ?>
	<p>
		<label><?php _e('What is the name of the ship in the TV show Firefly?') ?><br />
		<input type="text" name="user_proof" id="user_proof" class="input" size="25" tabindex="20" /></label>
	</p>
<?php }

add_action( 'register_post', 'add_register_field_validate', 10, 3 );
function add_register_field_validate( $sanitized_user_login, $user_email, $errors) {
	if (!isset($_POST[ 'user_proof' ]) || empty($_POST[ 'user_proof' ])) {
		return $errors->add( 'proofempty', '<strong>ERROR</strong>: You did not answer the proof-of-humanship question.'  );
	} elseif ( strtolower( $_POST[ 'user_proof' ] ) != 'serenity' ) {
		return $errors->add( 'prooffail', '<strong>ERROR</strong>: You did not answer the proof-of-humanship question correctly.'  );
	}
}

This adds an extra box to the register screen with the question “What is the name of the ship in the TV show Firefly?” The user-provided answer is then compared to the official answer. If correct, the user is registered, otherwise WordPress-friendly error(s) are returned.