Tuesday 21 January 2014

WordPress: Remove/hide Google+ field from Contact Info on user admin page

This WordPress tweak is pretty unlikely to come up for most developers, but I was asked to remove the Google+ field from the Contact Info section of the User admin page. Here's a quick snippet to paste into functions.php to do so:

function custom_admin_js() {
  // hide WP's Googleplus input on user profile
  if( strpos($_SERVER["REQUEST_URI"], '/user-edit.php')) {
    echo '<script type="text/javascript"> jQuery(\'#your-profile input[name="googleplus"]\').parent().parent().hide(); </script>';
  }
}
add_action('admin_footer', 'custom_admin_js');