Maybe I was burned out from work before, but this morning I took another go at the same code and managed to get it running properly.
if ( ! function_exists( 'comment_imgs' ) )
{
add_filter( 'get_comment_author_url', 'comment_imgs' );
function comment_imgs( $avatar, $id_or_email, $size, $default, $alt )
{
global $comment;
// We do not get the real comment with this filter.
if ( empty ( $comment )
or ! is_object( $comment )
or empty ( $comment->comment_author_email )
or ! $user = get_user_by( 'email', $comment->comment_author_email )
)
{
return $uri;
}
return get_avatar( $user->ID );
}
}
Credit for the original code goes to Thomas Scholz for linking to author pages, this modification retrieves local avatars and two functions don’t clash with each other.
Related Posts:
- Show custom default avatar instead of gravatar
- Change comments form title on a page by page basis
- How do I create comment-reply-button using element not
- Displaying Logged-In User Name and avatar in WordPress Menu
- Adding ads code between comments
- How do I fetch all comments per post via WP REST API?
- comments_number display outside specified span
- get_avatar won’t show uploaded avatar, only default gravatar
- WordPress Gravatar filter is removing my custom attributes
- Ajax load more button for comments wordpress
- Limit 1 global comment per minute
- Create Page To Count Comments For Each Post In WordPress Site
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- Alter required message using comment form api
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- Fetching Initials of the Commentator in the WordPress Website
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- Show all people who commented on all posts by an author
- How to get User Avatar Image with link to Author and User name in Html Title tag?
- How to get the rating value of each comment
- Trouble figuring out how to get my button to submit comment
- How do I change/modify the_post_thumbnail(); html output?
- How to call a PHP function from Javascript in WordPress
- How to preserve PHP modifications while upgrading WordPress?
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Shortcode created to check language not works
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- How to Append to the_excerpt() Function
- Listing all sub-pages?
- How to check if comments are paginated?
- Why do filters/actions require an argument count?
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Making Quote Plugin more efficient
- Adding tawk.to code just before body tag on functions.php file
- allow subscribers to see private posts without plug in
- Show comments menu in dashboard only if the site has comment
- add_action shortcut?
- remove wp floating submenu in wp dashboard
- ACF: how do I get the fields and its values of a specific group?
- Fatal error: Uncaught Error: Call to undefined function test()
- Get page that displays all children of taxonomy parent
- Return a numerical function value in Customizer controls
- How can I get the values of my WordPress $wpdb query in Jquery?
- Function to capture a value and store it in a variable
- Adding a widget function into the php theme file
- My new button is in the wrong place
- Checking array against author id in loop
- theme_root returning a truncated URI
- Call to undefined method – Download Monitor
- Use .php file as page instead of wordpress page & template file?
- Find hours between post_date and post_date_gmt
- Run a code only on theme activation only during first activation
- Shortcode from a function not working
- Is it possible to return content, and then also continue to do other things?
- Creating WordPress Shortcode with Variable
- How to add text to the start of all comments?
- Convert the_permalink() function output into string
- Add meta tags to a custom header
- get_current_site() is undefined
- How to use mysql LIKE with wpdb?
- blank white page when post/update/change option etc
- Function sanitize_title() does not appear to be working
- writing an unique php function to be used on my website
- Displaying Event within two given time frames
- How to prevent a function from running based on host (ie web vs local)?
- How to call custom function outside from the admin page?
- Output product category link from WP_Query
- Adding onload to body for certain pages
- Delete images from media library when user deletes an image from ACF Gallery
- Reject all malicious URL requests functions.php
- Change wordpress’ database data using ajax – how to get current user id?
- Add custom field on admin dashboard comments / reviews
- Display the list of user’s comments + the post title + date
- Best way to use variables in multiple functions?
- Notice: Undefined variable
- Cannot fetch posts with certain ‘product_cat’. WP_Query is empty
- How to override WooCommerce Order Item Meta with data from Cart?
- Taxonomy Child Term, Counter is staying on 0
- Access to “My Site” is missing from the admin bar
- Offset with ajax load more posts duplicates
- Need help with PHP functions
- Using get_theme_mod with checkbox to display content
- WordPress styling recent post
- Break a WordPress function to run in patches and re-continue
- Pagenav Not appearing on custom Template
- syntax error unexpected ‘}’ at 364 line
- get_post_meta no longer working
- Highlight posts currently being edited on multiple editor site?
- Why can’t I include echo inside a variable? [closed]
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- How do I change the Go To Categories link in the term_updated_messages
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- Understanding responsive imagery
- How to get meta box labels?
- Background Tasks in a WP Cronjob?
- Tags being Inserted in html from plugin PHP not passing through the_content
- Add/Modify rel=canonical of all the pages of a wordpress website
- Calling a PHP function from a menu item