That’s likely because you are using $current_user->ID
, which always refers to the currently logged in user, or when “empty” object if not logged in (ID == 0
). If you would like to update user meta on any other user you would have to supply the user ID of that user in the $_POST
data as well.
Related Posts:
- Update user meta using with ajax
- update_user_meta doesn’t work with AJAX
- How would you update a frontend form with AJAX
- Updating User Meta with Array on Click of Button AJAX
- Ajax Favorite from foreach (how to specify which result result is processed)
- Update user meta via ajax from frontend, saving issue
- Edit user meta on front-end via AJAX
- Update user meta using Ajax on front end?
- How to update my jquery/PHP function to add/remove user as favorites in (WordPress) users list
- jQuery: Performing synchronous AJAX requests
- Best way to end WordPress ajax request and why?
- Why use wp_send_json() over echo json_encode()?
- How to pass data parameter to ajax action function handler
- Contact Form 7 Custom Post Action
- WordPress function that makes HTML safe to be sent via AJAX request
- admin-ajax.php returns 0. How do I debug it and fix it?
- How to properly use wp.ajax.post?
- Detecting post type within init action
- Basic question on passing variables to AJAX in WordPress
- Metabox cloning via Admin Ajax call issue
- Change theme based on window size
- Serving nonces through AJAX is not refreshing nonce, returning 403 error
- help on wp_editor via ajax load [duplicate]
- delete_user_meta Delete one value out of array
- Cannot update my options using wp_ajax
- ajax and nonce when JavaScript is in a seperate file
- Class WP_Rewrite not found
- Prevent wp_debug from polluting ajax within plugin
- How to localize inline script called with ajax
- Conditional Ajax inclusion
- Buddypress ajax problem after adding new groups sub nav [closed]
- Allow AJAX call to other roles than admin
- How to check username availability with ajax at registration
- submitting form via admin-ajax.php returns 0
- Help add ajax load more button
- Can a wp_nonce created from domain 1 to be verified on domain 2?
- admin-ajax.php slow, how to speed it up?
- How to use several wp_ajax_ functions for different queries?
- Three level taxonomy dropdown frontend
- Unable to parse JSON response from wp_send_json_success [closed]
- How to solve “Updating failed” with 403 Error when trying to save a Site or Post in Gutenberg?
- Keep getting 400 Bad Request error when trying out AJAX on custom theme
- problem with WordPress ajax
- How to set post_id to 0 when you upload image via Add media button. (async-upload.php)
- Why is on status span no search results?
- eventON plugin AJAX call triggers website crash
- wp_enqueue_script() doesn’t work with AJAX
- Dynamically add more fields/remove last field in a form
- Save & Reset button in theme-option with Ajax (without refresh)
- Ajax Request for both logged and non logged users
- Ajax Multi Response Problem
- Force redirect single.php to index
- Any plugin or Script to integrate ajax selection module into WordPress page
- how should i get json encoded data from wordpress ajax action page
- WP_Ajax Hook doesn’t execute this PHP code
- How to include php-generated javascript?
- Serve a different theme based on window size
- custom autocomplete search
- post values to custom post type which has advanced custom fields
- How to continuously send feedback via AJAX responses to my client?
- get current taxonomy post with ajax
- WordPress Ajax Filter
- wp_ajax handler with multiple class instances
- admin-ajax.php (aborted) error when using jQuery.get
- Storing temporary data for a custom post type
- I get a 0 after the result of my ajax requests
- Not getting an ajax readystatechange on my page
- problem using ajax url
- Problems implementing Load More functionality
- admin-ajax.php error 500
- How to display contact form 7 form in vanilla js without jquery in frontend
- Error sending array data from php to javascript
- Sharing variables in both actions wp_footer and wp_ajax
- Add ajax to plugin in admin area
- Search live Ajax
- Ajax login fails: script sets cookies, but is_user_logged_in() returns false
- Using wp_send_json_success instead of $result[‘message’], die, etc
- do_action won’t work in ajax callback
- Opening Modal popup on Ajax form submission
- 400 Bad request while submitting form using AJAX
- AJAX POST Value not being returned – WordPress – AutoTrader API
- Its possible to ajax update the content of the admin custom post type list
- WordPress custom ajax login not working on mobile browsers
- Failed to load resource: the server responded with a status of 404 (Not Found) admin-ajax.php
- Javascript output now showing in custom widget
- Ajax call on class returns old data
- how to enable ajax on submitting of contact form 7?
- Create a post with REST API and adding a category
- delete post meta data in array WordPress
- Using AJAX on Contact-form the WordPress way
- Retrieve Header Background Image with AJAX
- Error while submitting form using AJAX and php
- AJAX call in backend results in empty update_option
- Ajax Comment: Page reloads whenever the comment submission form is reloaded
- How to fetch meta_value and meta_key in matrix after ajax request by post_id
- get_comments() returns empty array if called through AJAX
- Posting to loop.php file
- Can’t access data from database using AJAX
- $wpdb Ajax not redirecting to main page
- wordpress ajax bad request 400