I have a custom meta field I'm collecting on a membership site called "about" and would like for this to replace the Biographical Info meta box in the author profile. I'm thinking I need to use the filter for get_the_author_meta but I'm not totally sure. So if my meta field is user_about what do I need to do to get that to populate the Bio meta in the author profile?
1 Answer
You can use the filters the_author_$meta
and get_the_author_$meta
(where $meta is in this case 'description'):
add_filter('the_author_decription', 'custom_about_member', 10, 2);
add_filter('get_the_author_decription', 'custom_about_member', 10, 2);
function custom_about_member($description, $userid) {
$about = get_user_meta($userid, 'user_about', true);
if ($about) {return $about;}
return $description;
}
This of course relies on the place where the author bio is being displayed using the related function to get the description. eg. get_the_author_meta('description')
or get_the_author_description()
-
:-) you're welcome, feel free to mark the answer as correct if you like– majickCommented Jul 12, 2017 at 9:33