• Resolved Prabhakar

    (@trainingsadda)


    Hi,

    I have a website, where users can register and submit articles.

    But they are creating spammy links in “WordPress-Biographical Info”.

    I want to disable or remove the hyperlinks in that section.

    Can you help me with this issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • add_filter('pre_user_description','wpse_whitelist_tags_in_bio');
    function wpse_whitelist_tags_in_bio($description){
        $bio_allowed_tags = array(
                             'strong'=>array(),
                             'em'=>array(),
    						 'b'=>array(),
    						 'i'=>array(),
                            );
        $description = wp_kses($description,$bio_allowed_tags);
        return $description;
    }

    this will allow only the HTML tags you want, notice I’m allowing <b> <i> and but nothing else. You’ll have to re-save all user profiles to retroactively remove all the other tags.

    Thread Starter Prabhakar

    (@trainingsadda)

    Thanks for your code.

    Let me try this one also.

    I tried the below code it worked well in few themes.

    add_filter( ‘get_the_author_description’, ‘remove_html_link’ );
    function remove_html_link($link) {
    $end = preg_replace(‘#<a.*?>#i’, ”, $link);
    return $end;
    }

    But on my website [https://www.whatiswhatis.com/], there are 2 functions that are calling for the author description.

    Anyway, I hired the WordPress developer, he solved it.

    • This reply was modified 3 years, 2 months ago by Prabhakar.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to disable hyperlinks in author bio WordPress?’ is closed to new replies.