Skip to content

Instantly share code, notes, and snippets.

@joeyfigaro
Created June 4, 2013 12:46
Show Gist options
  • Save joeyfigaro/5705623 to your computer and use it in GitHub Desktop.
Save joeyfigaro/5705623 to your computer and use it in GitHub Desktop.
Wordpress Admin Functions
// ========================
// = Admin Area Functions =
// ========================
require_once(TEMPLATEPATH . '/help_page.php');
// After Registration Redirect
function __my_registration_redirect()
{
return home_url( '/thank-you-for-registering' );
}
add_filter( 'registration_redirect', '__my_registration_redirect' );
// Remove Generator
remove_action('wp_head', 'wp_generator');
// Admin Footer
function remove_footer_admin () {
echo "<strong>CTRM Center</strong> created by <a href=\"http://www.andrewcolby.com\">Andrew Colby</a>";
}
add_filter('admin_footer_text', 'remove_footer_admin');
// Remove Default Dashboard Items
function example_remove_dashboard_widgets() {
// Globalize the metaboxes array, this holds all the widgets for wp-admin
global $wp_meta_boxes;
// Remove the incomming links widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
// Plugins
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
// EasymMail
unset($wp_meta_boxes['dashboard']['normal']['core']['alo-easymail-widget']);
// Remove right now
//unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
// Hoook into the 'wp_dashboard_setup' action to register our function
add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
// remove unnecessary page/post meta boxes
function remove_meta_boxes() {
// posts
remove_meta_box('postcustom','post','normal');
remove_meta_box('trackbacksdiv','post','normal');
remove_meta_box('slugdiv','post','normal');
//remove_meta_box('commentstatusdiv','post','normal');
//remove_meta_box('commentsdiv','post','normal');
//remove_meta_box('categorydiv','post','normal');
//remove_meta_box('tagsdiv-post_tag','post','normal');
//remove_meta_box('authordiv','post','normal');
// pages
remove_meta_box('postcustom','page','normal');
remove_meta_box('commentstatusdiv','page','normal');
remove_meta_box('trackbacksdiv','page','normal');
remove_meta_box('commentsdiv','page','normal');
remove_meta_box('slugdiv','page','normal');
//remove_meta_box('authordiv','page','normal');
}
add_action('admin_init','remove_meta_boxes');
// Screen Options - Remove Columns
function my_remove_columns( $posts_columns ) {
unset( $posts_columns['comments'] );
return $posts_columns;
}
add_filter( 'manage_post_posts_columns', 'my_remove_columns' );
add_action( 'admin_menu', 'my_remove_meta_boxes' );
// Remove WP Logo
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('comments');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment