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
- Where are Additional CSS files stored
- How to use more than 256MB of memory in the admin?
- Localization: I want the backend: english and frontend in defined language
- How to get current_cat in navbar, in single post
- wordpress custom walker for thumbnails with custom menu
- Adding an email column to a Custom Post Types Admin Screen?
- Selecting An image from the Media LIbrary on the frontend
- Replace default avatar
- WordPress audio player has two different styles
- Allow Users to Set Password During Registration
- WordPress 3.1 removing ‘category’ from the slug
- Why does WordPress 3.0.4 keep deleting the contents of the .htaccess file?
- How to replace any occurence of Gravatars with a local placeholder image?
- Intercept invalid email during lost_password
- Only append custom classes to nav menu items
- Hide upload image fields for the different media upload popups
- WP-Admin gives 403 Forbidden after login on CentOS 7
- Custom Taxonomy Archive not displaying entries
- Creating Search Engine Friendly URL’s with Word Press
- Add Div to Comment Form
- Extend Screen Options
- How to add “Read More…” link in twentytwenty
- How to remove the search fields in Twentytwelve
- adding homework to a school’s website
- Understrap child theme JS not working in custom-javascript.js file
- Resizing of a header/div in a website through css in wordpress [closed]
- action user_new_form param is a string
- Login/Logout Session Sharing – Multiple WordPress Installations
- Customize Avatar using user meta
- How to redirect users to their profile after they successfully edit their profile
- Disable Gravatars in WordPress
- Which Function Displays The Post Authors Gravatar
- Where in code to replace content before display of page?
- Page content dissapears after loading the page [closed]
- How do I get a post author’s image/avatar via RSS from another blog?
- Changes in my child theme from customizer not appearing in style.css?
- Custom SELECT Query With Multiple Meta Values (Ordering Problem)
- Change Successful password reset message
- White letters in header
- How I can directly add drop-down in my product on shop page as show in below image
- Replace a ‘Title’ tag with a Custom Field
- Remove fields from WordPress profile
- How to create a custom WordPress front page
- Is it possible to integrate a custom login feature with wordpress?
- User Custom Dashboard
- Exclude current post but keep the same posts-per_page amount
- WordPress Command Question
- Add custom border across footer widget area
- How to make conditional statement in WpBakery (formarly Visual Composer)
- Widget recent comment filter by post meta_value
- Adding shortcode to product short description
- Display Custom Taxonomy Name As A Shortcode
- Problems with setting up a subdomain to serve images and scripts
- Why does a custom php code inside a custom template not get executed?
- Disable “-mp4-image” screenshots from appearing in Media?
- wordpress custom posts page not showing
- Wrap WordPress Login Form in custom Div
- Automatically reject a comment if website field contains anything
- Replace publish date in blog module with custom field
- Creating WordPress staging environment software
- How to add H1 Tag on Homepage?
- Use another theme template in my theme
- Display popular posts by how many hits it got within 30 days of publishing
- How to make my wordpress site responds for 2 domains
- User registration add user ID?
- Can’t Auto-Update, but permissions are good?
- How to answer, and we aren’t using WordPress to manage your site? [closed]
- Is there a way to have information on one page automatically feed into another? [closed]