iBlognet

How To Remove Auto Links From WordPress Author Bio

by Editor

UnlinkGuest authors have a practice to link to their own website using the biographical box in WordPress profile section, if they are guest posting on your blog. Even if you provide with a custom field to link their website, they would insert links, no matter what your guest posting guidelines says.

And if you’re managing a large blog with lots of guest authors, then it would be very much time consuming to manually remove the links, by editing each and every users profile. But you can automatically remove those links with or without anchor text.

If you’re using custom author box on your blog [like this], then search for the following code:

[php]<?php the_author_description(); ?>[/php]

And replace it with:

[php]<?php
// grab description,
$user_description = get_the_author_meta(‘description’);
// removing all tags apart from paragraphs:
echo strip_tags($user_description,'<p>’);
?>[/php]

And if you want to remove those links along with the anchor text then replace with the following code:

[php]<?php
// grab description,
$user_description = get_the_author_meta(‘description’);
// removing all links including their text (i.e. <a href=”…”>…</a>):
echo preg_replace(‘{<a[^>]*>(.*?)</a>}’,”,$user_description);
?>[/php]

If you’re a Thesis Theme user, you can add a custom author box with links to social media profiles without any plugin or if you’re using any other WordPress Theme which has single.php file in the theme package, then follow this tutorial by WPBeginner. If you have any query or opinion, you can leave a comment below.

Article by »


Admin and Editor of iBlognet iBlognet has written 294 fantastic article(s) on iBlognet.


Author Connect »

Comments on this entry are closed.

Previous post:

Next post: