Custom Favicon WP-Admin

function admin_favicon() {
echo ”;
}
add_action( ‘admin_head’, ‘admin_favicon’ );

Replace Default Gravatar with Custom Image

All you’ll need to customize is the path to your default image.

function custom_gravatar($avatar_defaults) {
$logo = get_bloginfo(‘template_directory’) . ‘/images/icons/gravatar_logo.jpg’; //Change to whatever path you like.
$avatar_defaults[$logo] = get_bloginfo(‘name’);
return $avatar_defaults;
}//END FUNCTION
add_filter( ‘avatar_defaults’, ‘custom_gravatar’ );

Auto Include Google Analytics Code

// Add Google Analytics Tracking Code
function add_google_analytics() {
?>

var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src='” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));

try {
var pageTracker = _gat._getTracker(“UA-XXXXXXX-X”);
pageTracker._trackPageview();
} catch(err) {}
<?php
}

add_action('wp_footer', 'add_google_analytics');

Add “Next-page”-button in WYSIYG-editor

add_filter(‘mce_buttons’,’wysiwyg_editor’);
function wysiwyg_editor($mce_buttons) {
$pos = array_search(‘wp_more’,$mce_buttons,true);
if ($pos !== false) {
$tmp_buttons = array_slice($mce_buttons, 0, $pos+1);
$tmp_buttons[] = ‘wp_page’;
$mce_buttons = array_merge($tmp_buttons, array_slice($mce_buttons, $pos+1));
}
return $mce_buttons;
}

Batch Deleting All Unapproved Comments

This SQL query will remove all of yourthe unapproved comments and will not touch your approved comments.

DELETE FROM wp_comments WHERE comment_approved = 0

Add Custom User Profile Fields

Place the code below into your functions.php file to add custom user profile fields. Edit or add lines as you see fit.

Remember not to remove the line: return $contactmethods; otherwise this won’t work.

// CUSTOM USER PROFILE FIELDS
function my_custom_userfields( $contactmethods ) {

// ADD CONTACT CUSTOM FIELDS
$contactmethods[‘contact_phone_office’] = ‘Office Phone’;
$contactmethods[‘contact_phone_mobile’] = ‘Mobile Phone’;
$contactmethods[‘contact_office_fax’] = ‘Office Fax’;

// ADD ADDRESS CUSTOM FIELDS
$contactmethods[‘address_line_1’] = ‘Address Line 1’;
$contactmethods[‘address_line_2’] = ‘Address Line 2 (optional)’;
$contactmethods[‘address_city’] = ‘City’;
$contactmethods[‘address_state’] = ‘State’;
$contactmethods[‘address_zipcode’] = ‘Zipcode’;
return $contactmethods;
}
add_filter(‘user_contactmethods’,’my_custom_userfields’,10,1);

Remove Default WordPress Meta Boxes

This code will allow you to remove specific Meta Boxes which wordpress adds by default to the default Add/Edit Post and Add/Edit Page screens.

// REMOVE META BOXES FROM DEFAULT POSTS SCREEN
function remove_default_post_screen_metaboxes() {
remove_meta_box( ‘postcustom’,’post’,’normal’ ); // Custom Fields Metabox
remove_meta_box( ‘postexcerpt’,’post’,’normal’ ); // Excerpt Metabox
remove_meta_box( ‘commentstatusdiv’,’post’,’normal’ ); // Comments Metabox
remove_meta_box( ‘trackbacksdiv’,’post’,’normal’ ); // Talkback Metabox
remove_meta_box( ‘slugdiv’,’post’,’normal’ ); // Slug Metabox
remove_meta_box( ‘authordiv’,’post’,’normal’ ); // Author Metabox
}
add_action(‘admin_menu’,’remove_default_post_screen_metaboxes’);

// REMOVE META BOXES FROM DEFAULT PAGES SCREEN
function remove_default_page_screen_metaboxes() {
remove_meta_box( ‘postcustom’,’page’,’normal’ ); // Custom Fields Metabox
remove_meta_box( ‘postexcerpt’,’page’,’normal’ ); // Excerpt Metabox
remove_meta_box( ‘commentstatusdiv’,’page’,’normal’ ); // Comments Metabox
remove_meta_box( ‘trackbacksdiv’,’page’,’normal’ ); // Talkback Metabox
remove_meta_box( ‘slugdiv’,’page’,’normal’ ); // Slug Metabox
remove_meta_box( ‘authordiv’,’page’,’normal’ ); // Author Metabox
}
add_action(‘admin_menu’,’remove_default_page_screen_metaboxes’);

Loading jQuery from the Google CDN

// even more smart jquery inclusion 🙂
add_action( ‘init’, ‘jquery_register’ );

// register from google and for footer
function jquery_register() {

if ( !is_admin() ) {

wp_deregister_script( ‘jquery’ );
wp_register_script( ‘jquery’, ( ‘https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&#8217; ), false, null, true );
wp_enqueue_script( ‘jquery’ );
}
}

Include custom post types in the search results.

// MAKE CUSTOM POST TYPES SEARCHABLE
function searchAll( $query ) {
if ( $query->is_search ) { $query->set( ‘post_type’, array( ‘site’, ‘plugin’, ‘theme’, ‘person’ )); }
return $query;
}
add_filter( ‘the_search_query’, ‘searchAll’ );

Remove Update Notification for all users except ADMIN User

This code will ensures that no users other than “admin” are notified by wordpress when updates are available.

// REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN
global $user_login;
get_currentuserinfo();
if ($user_login !== “admin”) { // change admin to the username that gets the updates
add_action( ‘init’, create_function( ‘$a’, “remove_action( ‘init’, ‘wp_version_check’ );” ), 2 );
add_filter( ‘pre_option_update_core’, create_function( ‘$a’, “return null;” ) );
}