Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Last active April 27, 2021 13:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefuxia/1610331 to your computer and use it in GitHub Desktop.
Save thefuxia/1610331 to your computer and use it in GitHub Desktop.
Plugin: Remove Bio Box
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Remove Bio Box
* Description: Removes the user biography field.
* Version: 2012.01.14
* Author: Fuxia Scholz
* Author URI: https://fuxia.me
* License: GPL
*
* See also: http://wordpress.stackexchange.com/q/38819/73
*
* Remove Bio Box, Copyright (C) 2011 Thomas Scholz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
add_action( 'personal_options', array ( 'T5_Hide_Profile_Bio_Box', 'start' ) );
/**
* Captures the part with the biobox in an output buffer and removes it.
*
*/
class T5_Hide_Profile_Bio_Box
{
/**
* Called on 'personal_options'.
*
* @return void
*/
public static function start()
{
$action = ( IS_PROFILE_PAGE ? 'show' : 'edit' ) . '_user_profile';
add_action( $action, array ( __CLASS__, 'stop' ) );
ob_start();
}
/**
* Strips the bio box from the buffered content.
*
* @return void
*/
public static function stop()
{
$html = ob_get_contents();
ob_end_clean();
// remove the headline
$headline = __( IS_PROFILE_PAGE ? 'About Yourself' : 'About the user' );
$html = str_replace( '<h3>' . $headline . '</h3>', '', $html );
// remove the table row
$html = preg_replace( '~<tr>\s*<th><label for="description".*</tr>~imsUu', '', $html );
print $html;
}
}
@thefuxia
Copy link
Author

Screenshot

screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment