• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to remove all comment authors links?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › How to remove all comment authors links?

This topic is: resolved

Tagged: comment link, comments

  • This topic has 6 replies, 2 voices, and was last updated 11 years, 11 months ago by saksham.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • December 25, 2013 at 1:44 pm #81189
    saksham
    Member

    Can anyone help me remove all comment author links?

    I used this code on a custom theme which no longer works on News Pro:

    function author_link(){
    global $comment;
    $comment_ID = $comment->user_id;
    $author = get_comment_author( $comment_ID );
    $url = get_comment_author_url( $comment_ID );
    if ( empty( $url ) || 'http://' == $url )
    $return = $author;
    else
    $return = "$author";
    return $return;
    }
    add_filter('get_comment_author_link', 'author_link');

    http://www.ahemahem.com/
    December 25, 2013 at 5:58 pm #81200
    nutsandbolts
    Member

    This will remove the URL field from your comment form, though it won't help if you need to remove author links in existing comments (let me know if that's the case):

    //* Remove comment author link
    add_filter( 'genesis_comment_form_args', 'url_filtered' );
    add_filter( 'comment_form_default_fields', 'url_filtered' );
    function url_filtered( $fields ) {
     
    if ( isset( $fields['url'] ) )
    unset( $fields['url'] );
     
    if ( isset( $fields['fields']['url'] ) )
    unset( $fields['fields']['url'] );
     
    return $fields;
    }

    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    December 26, 2013 at 3:16 am #81226
    saksham
    Member

    I want to remove links from existing comments too.

    December 26, 2013 at 7:21 pm #81338
    nutsandbolts
    Member

    If you don't have very many existing comments, it may be easiest to go through each one and edit to remove the URL. If that's too time consuming, you can get rid of them all via phpMyAdmin - just PLEASE make a backup before touching your database since it could break your entire site. If you aren't familiar with MySQL, I urge you to seek help with this.

    Disclaimers aside, executing this command in MySQL will remove all author URLs in existing comments:

    update wp_comments set comment_author_url = '';


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    December 28, 2013 at 1:27 pm #81627
    saksham
    Member

    Hello, is there a way to make my previous code work if possible which removes the URLs dynamically i.e. it doesn't show them in my blog post but they can still be seen in admin panel. I'm not sure why the below code doesn't work with News Pro. It works with my other Genesis child theme.

    function author_link(){
    global $comment;
    $comment_ID = $comment->user_id;
    $author = get_comment_author( $comment_ID );
    $url = get_comment_author_url( $comment_ID );
    if ( empty( $url ) || ‘http://’ == $url )
    $return = $author;
    else
    $return = “$author”;
    return $return;
    }
    add_filter(‘get_comment_author_link’, ‘author_link’);

    I am sorry if I'm asking for too much. 😉

    December 28, 2013 at 7:24 pm #81718
    nutsandbolts
    Member

    There has to be a difference between the way comments are called in the HTML5 child themes versus the XHTML themes. I would start here - this is the best reference for Genesis 2.0 I've ever seen: http://docs.garyjones.co.uk/genesis/2.0.0/package-Genesis.Comments.html


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    December 29, 2013 at 12:31 pm #81860
    saksham
    Member

    Well you are right. Anyways, I ran the SQL query and removed all author links instead.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble