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 to deprecate a function used in a plugin?
- How to manually fix the WordPress gallery code using PHP in functions.php?
- How to make a image-size selected by default in Media upload – WP v3.5
- adding a filter to a shortcode?
- Change the footer text on the login page
- Displaying post per day
- Use local image for default avatar
- Rewriting search and pagination base
- Copyright info change in Theme Child PHP
- Php string not working in WordPress Functions.php [duplicate]
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Insert After Second Paragraph Without Tag?
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Create an array from an array
- Using wp_get_image_editor in a standalone script
- Can I change a variable in a content part while calling it?
- How to break down importing of feeds
- Create Logout Link WordPress Admin Menu
- Use wp_get_recent_posts with search term
- Calculations in functions.php [closed]
- Choose To Display Post Views With An Options Panel
- Prevent Data Resubmission On Page refresh
- Get_avatar filter?
- Why does my callback function not work with this custom filter hook?
- How to create a php variable using WordPress the_title() function
- register_taxonomy() take much queries
- is there a benefit in using a constant over get_stylesheet_directory_uri?
- WooCommerce Tabs [closed]
- Shortcode with PHP issue “Undefined index”
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- How to check if a PHP string is different than meta field?
- Displaying posts based on category
- Countdown to date function?
- calling a custom field value inside functions.php
- Noindex Posts From Certain Authors In WordPress
- Gravatar image url is wrong?
- WordPress check if current taxonomy has child
- get post id from wp_insert_post for get_template_part
- This function is deprecated; use mysql_real_escape_string() instead
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Custom Taxonomy Select Menu: Setting default option value?
- How to add author’s posts link (HTML + PHP) inside a function to output it
- Enqueueing a code block from an options framework
- Conditional On custom field plugin metabox
- Adding a ‘style=’ bit to image_send_to_editor output
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- Exclude function from running on a certain page
- Auto create Nextgen Gallery on post creation [closed]
- Hide media for non logged in users
- How to set value selected using select2 jquery plugin
- Jetengine Forms – Media upload path
- Using ACF Relationship field to set post type to draft or published status
- is_front_page is not working in my functions.php
- Is it possible to update the dataset using update_post_meta
- Hide payment method based on user role AND minimum cart value
- Update $wpdb query with AJAX
- how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
- All categories options or All categories not Populating
- WordPress load javascript file if something… (after the page is loaded)
- Add class for the_post_thumbnail_caption()
- Wrapping shortcode content in a span or link
- Permission functions within wordpress
- Adding ID to a Listing but not inside WP_Query while
- WordPress display name string manipulation
- 2 small questions: How to redirect to a created page & show that pages title in wp, bp
- which table updated after logout?
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- Loop on a wordpress Page instead of content coming from the WP text editor
- Saving User Input to PHP Variable
- Undefined variable notice [closed]
- Dynamic Email Handler with ‘header (“Location: …’
- WooCommerce: write featured image dimensions to custom fields in product’
- Generate and upload screenshot as featured image for user-submitted post
- a problem in class in class-wp-hook.php
- transition_post_status hook, works – but not if the post is new
- change title of page dynamically
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page