0

I used to have this code which worked fine:

<div class="kabaut"><?php echo get_the_author_meta('description'); ?></div>

After the latest update, wordpress now adds <p> </p> tags for the output. How do I strip out these tags?

  • 1
    try using the get_the_author_description filter to strip out the <p> tags – inarilo Dec 12 '17 at 20:31
  • 1
    you can remove this with remove_filter("get_the_author_description", "wpautop"); – mmm Dec 12 '17 at 20:39
1

get_the_author_meta applies a filter get_the_author_{$field}, i.e. in your case it will be get_the_author_description:

function stripp($value) {
    return str_replace(array('<p>','</p>'), '', $value);
}
add_filter('get_the_author_description', 'stripp');

In case the p tag has attributes, you may have to modify the above accordingly, or use preg_replace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.