Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dkomando/6214787a8d36d9f13c9b to your computer and use it in GitHub Desktop.
Save dkomando/6214787a8d36d9f13c9b to your computer and use it in GitHub Desktop.
// Callback function to remove default bio field from user profile page & re-title the section
// ------------------------------------------------------------------
// Thanks to original code found here: https://wordpress.org/support/topic/remove-the-bio-section-from-user-profile
// More reference: http://wordpress.stackexchange.com/questions/49643/remove-personal-options-section-from-profile
// Alternate examples: http://wordpress.stackexchange.com/questions/38819/how-to-remove-biography-from-user-profile-admin-page
if(!function_exists('remove_plain_bio')){
function remove_bio_box($buffer){
$buffer = str_replace('<h3>About Yourself</h3>','<h3>User Password</h3>',$buffer);
$buffer = preg_replace('/<tr class=\"user-description-wrap\"[\s\S]*?<\/tr>/','',$buffer,1);
return $buffer;
}
function user_profile_subject_start(){ ob_start('remove_bio_box'); }
function user_profile_subject_end(){ ob_end_flush(); }
}
add_action('admin_head-profile.php','user_profile_subject_start');
add_action('admin_footer-profile.php','user_profile_subject_end');
@yayMark
Copy link

yayMark commented Oct 4, 2018

Thanks for this. I'm inserting a custom WYSIWYG field to allow for links in the bio, so I needed this.

I'm guessing
if(!function_exists('remove_plain_bio')){
should be
if(!function_exists('remove_bio_box')){
?

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