Did you try something like this?
User variables
<?php
// Define user ID
// Replace NULL with ID of user to be queried
$user_id = NULL;
// Example: Get ID of current user
// $user_id = get_current_user_id();
// Define prefixed user ID
$user_acf_prefix = 'user_';
$user_id_prefixed = $user_acf_prefix . $user_id;
?>
Display avatar
<?php $avatar = get_field( 'avatar', $user_id_prefixed ); ?>
<?php if ( $avatar ) { ?>
<img src="https://wordpress.stackexchange.com/questions/304395/<?php echo $avatar["url']; ?>" alt="https://wordpress.stackexchange.com/questions/304395/<?php echo $avatar["alt']; ?>" />
<?php } ?>
Related Posts:
- How to relate the Category to user?
- Should I use wpdb prepare?
- Is it mandatory to use $wpdb->prefix in custom tables
- $wpdb->insert_id
- Check for success of $wpdb->update() correctly
- WordPress and multithreading
- Preferred way to include Advanced Custom Fields in a plugin?
- $wpdb->insert is changing a value
- Actions or filters fired when data is saved in a custom table
- Retrieving custom fields with $wpdb->get_results
- Add new user and add meta at once
- Really simple query giving error in SQL syntax
- Custom Plugin Database relations
- why creating tables using $wpdb is not being executed while installing plugins?
- How to add quick edit and bulk edit fields to users admin section
- How to use mysql IN statement with wpdb update method?
- What is rich_editing?
- Using $wpdb object in a widget
- Activation hook not creating table
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- $wpdb -> Batch insert from XML File?
- Ensure function has completed before allowing another Ajax call
- How to Download and install plugin database remotely
- How to insert data to a database table when the field is not yet created?
- Where to store the name of a custom table?
- include wp-blog-header not working on MAMP
- creating custom function to log actions in plugin
- SQL query for custom taxonomy slugs
- How to add custom fields to the all users page
- Issue regarding $wpdb->prepare()
- Error on inserting a form value to database
- How to create database table, add data, update and delete using wpdb via plugins?
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- how to search users by ajax live search
- Adding custom end points, No error line
- Intermittent database errors when accessing WordPress database
- Storing data in wordpress database from ajax call from different website
- How to Bind one post object Type with other postobject Type in Advanced Custom field [closed]
- WordPress allows multiple users to have same email ID; and I’ve a problem with it!
- wpdb->prepare and mysql UPDATE – how is it done?
- How to build a fool proof AdSense revenue sharing model?
- How to pull user/author profile data in a plugin?
- How can I add a simple custom field to my plugin?
- $wpdb->prepare with LIKE and sprintf
- How to optimize multiple insert into wordpress database
- Custom avatars in wordpress comments?
- $wpdb->update() always need a second try
- Associate multiple email addresses with the same user account, so they can log in with either
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Change/Set Page Title and Meta Tags from Page Called within a Plugin
- Update a user profile via frontend
- How do I validate extra pin field on my WordPress login form page?
- Data inserted by wpdb insert is different than data pressnt in database.
- Proper Prepare Statement for ALTER TABLE and using AFTER
- $wpdb->prepare is not working like mysql_real_escape_string
- How to avoid conflicts with db.php / $wpdb and other plugins that decide to use them?
- $wpdb in php 5.5
- Plugin to create Posts and Forums then choose category and parent forum
- $wpdb->update Issue
- How to call function from another plugin?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Why doesn’t my Table get created?
- Catching a GET parameter from the URL and save it in the user meta when a user registers
- Attaching Image-file to userId
- How to display specific data from a custom table to logged in users with a custom role
- $wpbd->insert_id is returning null
- ACF Field value in wordpress login message filter
- How to store sensitive user data (passwords)
- Insert, update or remove data from database (usermeta)
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- WordPress Query doesn’t return the correct value
- User meta query using Wildcard
- using wordpress acf shortcods in tables goes outside the table
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- Update database record in plugin
- WordPress function is not called and ajax return 0
- Dedicated server and WPDB Class : huge slow-down of the website
- How to implement pagination into a wpdb->result query?
- Plugin MySQL SELECT custom data and filter on user meta
- How to CRUD from wordpress database in wordpress theme?
- I can’t write in my DB using $wpdb->insert
- $wpdb how can i save my postmeta table before querying it
- How to work with AJAX and WordPress?
- WordPress plugin tables become corrupt
- Nothing happens on WordPress Update command
- Fixing plugin for wpdb::prepare
- Create Unique and Customized User ID for Website Members in WordPress
- Advanced Custom Fields conflicting with custom plugin when saving custom field
- Adding custom avatar field to comments
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- How to get custom user meta by id in custom Gutenberg block
- Load images from CDN and custom features to “Add Media” dialogue
- multiple record insert creating many duplicate records
- What are the default WordPress password requirements?
- How to update/auto-update my private plugin? [duplicate]
- Can a plugin be used to contain all custom functions to extend other plugins
- Programmatically modify an admin page UI of a WordPress site from my WordPress plugin
- How do I link to a php file in my plugin directory?
- Bootstrap collapse in custom WordPress widget