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
- Check if user already visited this post today
- PHP/Manual use of images? – 2 Questions
- How to display multiple Post meta_key/meta_values by SQL query
- How to update single value in multi dimensional Post Meta?
- Showing user ID on user main page from screen options
- Set Primary category using the Yoast SEO plugin
- How can update custom meta for all posts
- 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
- 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
- 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?
- 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?
- Sort custom meta column by other meta value
- 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 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]
- Archive post by meta value + 24hours
- Use of wp_insert_post and parameters
- a:0:{} is replaced into database as s:6:”a:0:{}”;
- Is it possible to retrieve all posts with a certain value for metadata?
- Read array in php?
- Querying Database with wpdb
- Countdown to date function?
- How to update and save user metadata on page visits?
- If Array Values Match Another Array’s Values, Then
- User Meta Value not echoing despite Var_Dump Showing correct string
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Getting different user data depending on where I use variable
- How to store multiple custom meta box
- Add new post in existing categories using wp_insert_post
- get post id from wp_insert_post for get_template_part
- 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?
- Update post meta – Custom field does not match meta-key
- Edit Account – read and write to MySQL
- Define category ID using get_post_meta
- Unable to Call More than One Meta Box Output
- Hide a div when a custom field is empty
- Update value of a associative array with update_post_meta
- Front end file upload returning wrong attachment url
- Post meta select input, if statement
- how to add datas in taxonomy to post with wp_insert_post
- WordPress stripping out custom field tags
- Order category posts by last word of custom field
- How to update custom fields when post is published?
- User meta needed in query is serialized – how to unserialize safely?
- Include User ID in iFrame URL
- Delete post meta by serialized meta value
- Store data from JavaScript object to custom table in user account
- Show a text if the post has written by author user role in WordPress
- Updating User Profile information removes image
- Hide author from search results meta, still display date and categories
- Fix common misspellings/errors based on array of replacements
- How to change the value of a variable using input field?
- Where do I implement this display of User Meta Data, and how to put it in a table?
- Unable to update the meta boxes with multiple fields
- Reverse Cross-Sells (WooCommerce)
- Get field in readable word
- Remove item from post_meta array via AJAX
- how to call other plugins once custom post has been inserted
- How can get all users by current user meta (array)?
- Efficient way of querying for a “fallback” post?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- Updating meta_value in a custom key
- Post from front end form to post_meta
- Limit the number of successful logins
- Order by in foreach
- retrieve wordpress post-meta using php not wordpress functions
- Postmeta not saving
- Get author meta of all writers
- If custom field doesn’t exist, or exists and it’s true show title?
- Let users register weight each day and save it in DB
- get_post_meta no longer working
- Post content not showing some content
- upload images on front by user using form
- Metadata on the WP_Post object
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- A better way to write this php function
- Import users and custom user meta from csv
- Can’t send form data to wpdb when URL has query string