Dalton Sutton
Dalton SuttonLiberty-minded. Musician. Full Stack Developer.
Code Snippets tagged with #admin
Here are some helpful code snippets that you might find useful.
<?php

// Function to remove various default dashboard widgets to declutter the user interface
function daltonsutton_remove_dashboard_widgets() {
  remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
  remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
  remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
  remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
  remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
  remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
  remove_meta_box('dashboard_primary', 'dashboard', 'side');
  remove_meta_box('dashboard_secondary', 'dashboard', 'side');
  remove_meta_box('dashboard_activity', 'dashboard', 'normal');
  remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
  remove_action('welcome_panel', 'wp_welcome_panel');
}
add_action('admin_init', 'daltonsutton_remove_dashboard_widgets');
WordPess Remove Dashboard Widgets
#wordpress#admin#admin_init
PHP
<?php 

// Rewrite Welcome to WordPress text in bottom right hand corner.
function daltonsutton_replace_footer_admin() {
    echo '<span id="footer-thankyou">&copy; '.date('Y').' <a href="'.get_bloginfo( 'url' ).'">'.get_bloginfo( 'name' ).'</a>. All rights reserved.</span>';
}
add_filter('admin_footer_text', 'daltonsutton_replace_footer_admin');

// Rewrite WordPress version in bottom right hand corner.
function daltonsutton_replace_footer_version() {
    echo 'WordPress v'.$GLOBALS['wp_version'];
}
add_filter('update_footer', 'daltonsutton_replace_footer_version', 9999);
WordPress Replace Admin Footer
#wordpress#admin#admin_footer_text#update_footer
PHP
© 2024 Dalton Sutton. All rights reserved.