Skip to:
Content
Pages
Categories
Search
Top
Bottom

Replacing User Avatar with ACF Image Field


  • stephonomon
    Participant

    @stephonomon

    Is there a way to tell BBPress to use an advanced custom field image instead of the default user image?

Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    bbpress uses the wordpress default avatar as set in

    dashboard>settings>discussion

    There are plugins that let you add additional defaults eg

    Add New Default Avatar

    or use code in your functions file or a snippets plugin (https://en-gb.wordpress.org/plugins/code-snippets/) such as

    add_filter( 'avatar_defaults', 'mytheme_default_avatar' );
    function mytheme_default_avatar( $avatar_defaults ) 
    {
        $avatar = get_option('avatar_default');
    
        $new_avatar_url = get_template_directory_uri() . '/images/default_avatar.png';
    
        if( $avatar != $new_avatar_url )
        {
            update_option( 'avatar_default', $new_avatar_url );
        }
    
        $avatar_defaults[ $new_avatar_url ] = 'Default Avatar';
        return $avatar_defaults;
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar