If you want to update meta on registration like this I think a better option would be to use the register_new_user
hook with add_action
. https://developer.wordpress.org/reference/hooks/register_new_user/
So something like:
add_action('register_new_user','my_update_meta',10,1);
function my_update_meta($user_id){
update_user_meta($user_id, 'show_admin_bar_front', false);
}
If in doubt, hooks/filters/actions tend to be the best option for WordPress work.
Related Posts:
- Calling a method from functions.php on a click of a button
- Showing user ID on user main page from screen options
- Issue with foreach on duplicate meta_key’s
- get_usermeta() deprecated in favor of get_user_meta(). But why doesn’t it make use of it?
- How to display user nickname (not display name) in PHP template?
- Get all user meta by meta key instead of ID
- Create a new usermeta field for users
- How to get a list of all possible values of a specific user meta key?
- How do I display a user’s previous orders as a select box option on a product?
- How to use an associative array in post__in with WP_Query?
- How to check if a meta value has already been assigned to any user?
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- function to assign user role based on a field from usermeta
- How to upload a file to a folder named after the user_id via plugin
- Creating user status mode in WordPress
- How can I save unique user data on my site? [closed]
- Adding number to date not working [closed]
- How to abort saving data in save_extra_profile_fields function WordPress?
- Let Users Choose Post Categories
- Update user profile information from functions.php
- a:0:{} is replaced into database as s:6:”a:0:{}”;
- Read array in php?
- Countdown to date function?
- Getting users with a specific meta data and then querying their posts?
- How to update and save user metadata on page visits?
- Login redirect. Check user meta and redirect accordingly
- If Array Values Match Another Array’s Values, Then
- User Meta Value not echoing despite Var_Dump Showing correct string
- Shortcode for Listing Users from Meta Value?
- Getting different user data depending on where I use variable
- Adding Author Box Meta Links with Co-Authors
- Get the users that my following users are following
- Comapare get_user_meta value
- How can get all users by current user meta?
- Edit Account – read and write to MySQL
- Uses for function: wp_update_user
- Update user repeater meta (ACF) with another user meta field value
- Create condition for Author bio Social Links
- How to store checkbox data for individual users?
- How do I Populate a Table Field with User Meta Data?
- How to add and subtract user meta values after post meta update
- User meta needed in query is serialized – how to unserialize safely?
- Include User ID in iFrame URL
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- Usermeta data unserialize, extract and display in table in WordPress
- Store data from JavaScript object to custom table in user account
- Export WordPress User Meta to CSV/Excel
- Updating User Profile information removes image
- How to change the value of a variable using input field?
- Display current user metadata on WordPress page
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Get user by meta data key and velue
- Where do I implement this display of User Meta Data, and how to put it in a table?
- Update an additional user meta field with a string
- Add another role to a user when they click a button?
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- not able to access $_POST on backend profile update
- Right way to display the_author_meta fields?
- Adding user meta to post meta wp_insert_post() not working
- Get meta_query value by user meta array
- Creating a custom register form
- get_users when from meta key that has serialized values
- How can get all users by current user meta (array)?
- Store stripe info as user_meta
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- Updating meta_value in a custom key
- Limit the number of successful logins
- Get author meta of all writers
- Let users register weight each day and save it in DB
- Hide a nav menu item based on get_user_meta results
- A better way to write this php function
- Import users and custom user meta from csv
- dbDelta support for FOREIGN KEY
- Initialize WordPress environment to use in a real cron script
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 64 bytes)?
- How to Add a Link to the Drop-Down User Menu in the Admin Bar?
- Remove username in emails or swap username for email
- What SQL / WordPress queries would need a nonce?
- Creating bulk posts with Youtube videos
- How to test nonce with AJAX – Plugin development
- Return a numerical function value in Customizer controls
- theme_root returning a truncated URI
- Only first shortcode gets executed
- Error while setting role
- Adding Updated Post Date PHP Custom Theme
- Create a a form for custom taxonomy terms
- How to make blog post entries appear as input form instead of just text?
- Trying to add Custom Post Type to this functions.php command
- get Woocommerce product format json for WP_Query
- Refresh page after login with litespeed cache
- remove_action() not working in page template – Genesis
- ajax form with multiple submit buttons and values
- Unserializeing multiple column values that are stored in one database results variable
- wp_enqueue_style conflict when using in different action hooks
- WordPress developer
- wp_enqueue_scripts with JS script as a string
- How to sort search result by post_title, then by post_content
- Custom Admin Menu Report for Specific User ID