• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Callia Web

Callia Web

Websites - Design with Purpose

  • Home
  • Websites
  • Support
  • Our Work
  • About
  • Contact

Disable comment avatars in Genesis

30 Mar 2018

A client of ours wanted to disable the comment avatars on her blog and initially we thought that simply taking the tick out of setting “Avatar Display” would do it. However that disabled all avatars including the avatars in the author box and the Genesis user profile widget, not what we wanted.

Avatar display settings

So we had a rummage in the Genesis Framework code and in genesis/lib/structure/comments.php there is a filter called genesis_comment_list_args which in turn calls wp_list_comments.

In the codex for wp_list_comments it states that:

avatar_size ( integer ) Size that the avatar should be shown as, in pixels. http://gravatar.com/ supports sizes between 1 and 512. Use 0 to hide avatars.

So it looked like it would be simple to add a filter using genesis_comment_list_args to give an avatar_size of 0. However, this returned an avatar of 96px!

Turns out this is because in the function used to output the comments in Genesis there isn’t a check for $args['avatar_size'] being equal to 0 before calling get_avatar, and get_avatar checks for a value less than 1 and applies a default value of 96px. The default WordPress function for outputting the comments does this check.

So our first choice is to use the same filter to stop the use of the Genesis comment function by supplying a blank string to the callback arg.

You can view the code below on github too.

add_filter( 'genesis_comment_list_args', 'jmw_disable_genesis_comment_avatar' );
/**
 * Disable comment avatars in Genesis.
 * Set comment avatar size to 0 and use the default WordPress comment function instead of the Genesis one.
 *
 * @param array $args Comment args
 * @return array Filtered comment args
 */
function jmw_disable_genesis_comment_avatar( $args ) {
	$args['avatar_size'] = 0;
	$args['callback'] ='';
	return $args;
}

This has the downside of losing all the Genesis hooks in genesis_html5_comment_callback and the format is a little different.

If this matters to you then you have a second choice. This is to copy the genesis_html5_comment_callback function and create your own custom comment function with a check to ensure $args['avatar_size'] is not equal to 0 before the get_avatar function. Then call this function using the genesis_comment_list_args filter.

An issue has been submitted to the Genesis github repo (if you have access) to add this check to the Genesis comment functions. If/when this fix is added then you can remove the $args['callback'] =''; line and use the Genesis function.

Featured Image: Photo by Toshi on Unsplash

Share this post:

Share on FacebookShare on LinkedInShare on E-mailShare on WhatsApp

About Jo Waltham

Jo Waltham is the founder of Callia Web and is passionate about helping people with their websites.

Liked this post? Subscribe to get our next post direct to your inbox.


Previous Post:padlock and chain7 website mistakes that make potential customers think you’ve gone out of business
Next Post:How to spring clean your blogHow to Spring Clean your blog on Callia Web - Image nik macmillan unsplash

Reader Interactions

Comments

  1. Mike Hemberger

    30 Mar 2018 at 2:56 pm

    Hey Jo! I’ve had to do this before as well, and did it directly with the get_avatar() filter. See here:

    // Remove avatars.
    add_action( 'genesis_list_comments', function() {
        add_filter( 'get_avatar', 'prefix_remove_avatars' );
    }, 0 );
    
    // Add them back, by removing the filter that removes them.
    add_action( 'genesis_list_comments', function() {
        remove_filter( 'get_avatar', 'prefix_remove_avatars' );
    }, 999 );
    
    // Return empty string.
    function prefix_remove_avatars() {
        return '';
    }
    Reply
    • Jo Waltham

      30 Mar 2018 at 3:00 pm

      Thanks Mike. I like your solution because you can still use the Genesis comment function.

      Reply
    • Urvashee

      26 Mar 2019 at 12:40 am

      Looking for exactly this. Thanks so much for sharing!

      Reply
  2. AJ

    4 Jan 2020 at 3:28 pm

    I was struggling to find a solution to this problem as well. Although the following linked page doesn’t appear to be specific to Studiopress themes, the simple code provided worked perfectly for me for removing the comment avatars while retaining the author box functionality: https://www.billerickson.net/remove-avatars-from-comments/

    Reply
  3. Jo Waltham

    4 Feb 2020 at 11:53 am

    Thanks for the link AJ. Bill always has very neat solutions.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Ready to get started?

Get in touch

Ask Callia Web’s AI

Contact us

Telephone: 01672 666001

Email: hello@calliaweb.co.uk

Quick links

Websites

Our work

Testimonials

About

Blog

Popular posts

Using headings in WordPress

Accessibility basics

Image sizes and aspect ratios

Making images equal size

Beginner’s guide to Analytics

Legal

Privacy policy / Cookie policy

Terms of service

Company number: 08316519

Registered address: Bowman House, Royal Wootton Bassett, Wiltshire, SN4 7DB

Copyright © 2025 · Callia Web Ltd · All Rights Reserved