when you use add_post_meta
with the argument $unique = TRUE
and the meta already exist, the value is not changed
https://codex.wordpress.org/Function_Reference/add_post_meta
If you want to update a meta, use update_post_meta
update_post_meta($post_id, 'wpcf-branch-order', $branch);
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- Creating user status mode in WordPress
- How to add and subtract user meta values after post meta update
- Get meta_id along with meta_key and meta_value
- How can merge two arrays values in one array and save in database
- Check if user already visited this post today
- Display all meta for a post?
- PHP/Manual use of images? – 2 Questions
- How to display multiple Post meta_key/meta_values by SQL query
- the_post_thumbnail() based on the Post ID
- How to use multiple query with same meta key
- How to update single value in multi dimensional Post Meta?
- Calling a method from functions.php on a click of a button
- Showing user ID on user main page from screen options
- Set Primary category using the Yoast SEO plugin
- Why is my get_post_meta always empty
- Compare two meta key values against each other inside the get_posts array?
- How can update custom meta for all posts
- Use ajax to update_post_meta
- 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 increase custom post value by one most efficiently?
- Batch update a post meta field value of each post in Post Type
- How to Display Image Meta underneath EVERY image in EVERY post
- wp_insert_post not working
- Change description on specific WooCommerce product status change
- How to display user nickname (not display name) in PHP template?
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- Use WP_Query in shortcode
- 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?
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Random order of WP_Query results with highest meta value
- The text box have space character
- how to remove metadata from the posts of my blog?
- How can I create a list of page titles from custom meta values?
- Can’t get wp_insert_post to work
- Trying to remove post thumbnail with plugin
- Randomly Assign an Image’s Alt Text Based on Data From Post
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- How to use an associative array in post__in with WP_Query?
- get_*_meta doesn’t always return an array
- How to check if a meta value has already been assigned to any user?
- Sort custom meta column by other meta value
- 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
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to upload a file to a folder named after the user_id via plugin
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Need help with Google drive API [closed]
- Auto-Select Parent Category as Primary
- How can I save unique user data on my site? [closed]
- Adding number to date not working [closed]
- Don’t insert if permalink is the same?
- How to abort saving data in save_extra_profile_fields function WordPress?
- Let Users Choose Post Categories
- Archive post by meta value + 24hours
- Update user profile information from functions.php
- WordPress update_post_meta updating with empty meta_value field [closed]
- Use of wp_insert_post and parameters
- Getting error when using wp_insert_post()
- a:0:{} is replaced into database as s:6:”a:0:{}”;
- Is it possible to retrieve all posts with a certain value for metadata?
- Get post id within comments loop
- Non-Closing PHP Query in WordPress Loop
- Read array in php?
- Querying Database with wpdb
- Countdown to date function?
- update_post_meta only updating on last loop of foreach
- how to get serialized post meta
- Getting users with a specific meta data and then querying their posts?
- How to use two meta_compare in an array?
- How to update and save user metadata on page visits?
- wp_insert_post() with HTML tags using PHP
- 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
- Remove empty terms from array, sort alphabetically, update back to repeating field
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Shortcode for Listing Users from Meta Value?
- WordPress yoast seo plugin – parse snippet var in meta description
- Getting different user data depending on where I use variable
- How to store multiple custom meta box
- Adding Author Box Meta Links with Co-Authors
- Add new post in existing categories using wp_insert_post
- Get the users that my following users are following
- get post id from wp_insert_post for get_template_part
- Returning all values from foreach in function php [closed]
- How to add post meta in while loop?
- Generate CSV file and add data as a new wordpress custom post
- Add category to post meta
- Comapare get_user_meta value
- How can get all users by current user meta?
- Using rules in Posts
- Update post meta – Custom field does not match meta-key
- Order a WP_Query by meta value where the value is an array
- Save the value of a wp_dropdown_pages
- Edit Account – read and write to MySQL