I managed to come up with the answer 😀 Thanks to @Jos
function ht1_change_avatar($args, $id_or_email) {
$gender = get_user_meta($id_or_email, 'user_gender', true);
if($gender=='Male'){
$myavatar="http://localhost:81/matrimony/wp-content/uploads/2020/04/groom.png";
}else{
$myavatar="http://localhost:81/matrimony/wp-content/uploads/2020/04/bride.png";
}
$args['url'] = $myavatar;
return $args;
}
add_filter('get_avatar_data', 'ht1_change_avatar', 100, 2);
Related Posts:
- Can I create front-end editable user profile pages with WordPress? How do I do it?
- custom default avatar showing broken link
- How do I add nopin=”nopin” to the default avatar?
- How to add checkbox and radio button in Profile Page
- How to filter get_avatar?
- Upload gravatar in WP profile?
- How do I add a custom HTML attribute to get_avatar?
- How to Save Different Usermeta Fields According to User Role?
- generate unique number when registering a user
- Extra User Profile Field Upload File / Image
- Syncing Avatars across multisite
- Unique User Account Number + Displayed Via Shortcode
- Creating user relationships
- How to display user’s avatar on their profile page?
- Ability to only view (not edit) other user’s personal profile information
- custom avatar removal
- Create membership number for existing/new users
- Add custom profile field only for site admins?
- Undefined variable: user_id in get_user_meta
- Change admin avatar only (without Gravatar or plugin)?
- Custom Field Repeating When Using foreach
- Is there a possiblity to replace profile image gravatar with custom user images
- how to add wp-user fields to front-end form
- custom user meta query
- Inline-Table under TwentyTwelve not working
- Create Unique ID for user
- User profile Pick a premade Design/theme
- Use a custom page with dynamic content as a user profile page
- Custom Avatars for WordPress Comments VIA Website URL?
- Need help with drop down list on the profile
- Problems with WP 6.1.1 and the get_user_meta() function
- Some data of one custom user profile is erased when I update another custom user profile
- How do I map two domains to the same wordpress installation?
- Header image doesn’t show up on page
- WordPress shows admin’s avatar after editing a comment
- How to get name and email value from a custom form and add it to campaign monitor subscriber list?
- How to work around the bug which prevents custom menus from being deleted?
- Redirect Every Instance of The Author Template Pages to Custom Author Pages
- Display popular posts by how many hits it got within 30 days of publishing
- Custom display for homepage, tag and author pages
- Why, when it comes to custom background and image, does ‘The first value registered’ win?
- Class .current-menu-item in custom menu Walker
- Create a google friendly header with text and logo
- Disallow “contributors” to edit their own posts once they’ve been set to “Pending Review”
- Add several fields from different tables to post, fields per post are in same row of table
- Allow arbitrary text after page URL
- Changing a setting in the wp-admin/customize.php reverts CSS styles to parent theme [closed]
- Customizer API and pages
- Possible to make a site like urban dictionary using WP?
- insert autofocus in a custom taxonomy form
- Function to query by custom field and category
- Bulk product editing in wordpress
- Turn Autocomplete on
- Image Upload Failing from WP_Editor
- Custom field front end update in wordpress
- Secondary loop doesn’t work
- ACF Shortcode bringing in my shortcode is adding unnecessary line breaks
- WordPress integration with Backbone or AngularJS
- Best way to replace image url with source
- Integrate non-wordpress site into a wordpress site
- Taxonomy template by post type
- How to loop through 1 CPT with 2 Taxonomies
- Make User Role a Filter
- WordPress custom search – pagination
- Where should I put this custom data?
- Show custom default avatar instead of gravatar
- Pulling posts into static site (wordpress as subdirectory)
- Call a duplicate registration form with other url
- Creating a search with tag variable also added for more detailed results
- Add date under slider/grid featured content
- WP_Customize_Image_Control and selecting from library?
- Show WP content on different PHP Sites
- Custom Link In WordPress Media “Attachment Details” Upload Screen
- Add field to post form
- Unable to retrieve data from multiple WordPress websites on same server
- Change the functionality of wordpress users module in admin
- Is it possible to sync nav menus across multiple wordpress sites?
- Is it possible in WordPress
- Confused about customising widgets
- Editing a theme’s templates
- How to use hook admin_init for add_action for custom post type column
- display my pages html
- Display Custom Posts
- Edit a custom admin page
- Customizing the built-in Media Playlist
- Best way to create a page outside of the pages list
- What shortcode should I use for
- Custom user fields validation on registration
- Pre_Get_Posts order DESC not registering
- For one linked image per post, override that link with a permalink when on the main page
- Database custom table issues – incorrect result displayed
- If I delete my wordpress site then does that delete all my sites?
- Special characters showing in fallback font
- Is there a way to hide a user’s posts from their Activity feed?
- Multiple Taxonomies Using Custom SQL Query
- Pass the post ID
- I need to display post related info
- Hide user fields based off capability
- Is there os native application for wordpress?
- Create Custom Admin Fields