$enddatevar = get_post_meta( $post_id, $key = 'enddate', $single = false);
$post_id is not defined, either declare it beforehand, or use $post->ID.
update_post_meta( $post->ID, 'promote', '$enddatevar' );
‘$enddatevar’ shouldnt be inside quotes.
Related Posts:
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Max length of meta_value
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- get_pages sort alphabetically by meta value
- Assign/update the custom field value for all posts
- Order by custom field date with ASC order
- How to break meta values into different items and avoid duplicates?
- WP_query : meta_key with custom rule for specific value
- How to sort category by custom field value
- trim custom field text value and show (…)
- Query post order by post and desc not working
- How to wrap meta values seperated by comma in ? [closed]
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- Run a check for multiple meta key values
- Filter by custom field (meta_key) using JSON API
- Removing link ” from ” on meta_value in custom feilds
- Sort alphabetically by custom field
- pre_get_posts : only get posts by wp_usermeta value
- meta_value and meta_key filtering returning no posts [closed]
- IF Custom field value equals ZERO
- List custom field values in alphabetical order without repetition
- Update post meta custom field using block editor
- How to add custom filed value after in wp post title
- Sortable Custom Columns not sorting correct
- query_posts with meta_value
- Show array of meta_value in Edit Post Coloum
- Making WP_Query limit results by date before today where date is a meta_query
- User query – getting values for custom meta keys/fields
- get posts based on non-single metadata
- Set class if a meta value is set within post archive
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Create Shortcode shows only posts with custom_field meta
- 4 Unique Random Posts based on Custom Field Values
- Custom Field: Display only if a specific key is selected outside the loop
- WP Query Args – search by meta_key or title
- Saving multiple custom meta box fields
- get Custom field label (select/dropdown) on front end
- Individual Widgets per Page
- Add custom fields to search
- How to add add_meta_box to specific Page Template?
- How to get users by a custom field / by user meta data?
- Auto sort the wp-admin post list by a meta key
- Add custom field to image editor
- Show User Their Password
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- ajax delete value from custom field array
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- Gravity Forms: Create fields programmatically
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Add source URL from Feed WordPress (Syndication) plugin to a custom field in post editor
- List custom taxonomy terms from custom field
- How do I create a column in Users list and display user data from custom registration field
- Better Method for Multiple Meta Boxes
- Product Custom Fields with HTML and JS
- Add new image block, set default class name and update it using Javascript
- Add image to menu item with ACF
- Client PDF Upload (Catalogue) – Automatically update link to PDF
- How to load an assets based on custom field value?
- Adding auto-complete to custom gravity field not working
- Search in Archive Pages by subcategory, tag, custom field and year
- Get image url using image id
- Using a custom field inside a shortocde
- Add Custom Profile Field as Notes
- ul list with only as many li’s as filled custom fields
- Is there a way to dump all registered sidebar/widget?
- How to hide post meta
- ACF Plugin How to make the customer add more fields in the post?
- custom field in admin columns
- get_post_meta returns 0
- Users uploaded image and matching an id or taxonomy
- Adding data to User profile
- How can I change author of posts to the value of one of the custom field of the posts?
- Let any visitors delete a post if they know Id nr & password?
- update a custom field with the value of another existing custom field
- Post meta data not showing in frontend, until hitting ‘update’ button
- Ordering posts by custom fields (Date)
- PHP and Shortcode Combination
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- How to properly get popular Posts by multiple Values
- Sorting Posts with meta value not working
- Query Custom Fields in Searchform
- Get custom fields when hover link of post
- WP Query multiple select form – meta_query help
- update_post_meta not working in action hook
- Group pages by custom field values
- Convert many posts from having a specific meta_key to use a post_format
- How to check if custom field exists in this widget query
- display loop only if a post meta data exist
- Add Custom field under the post title [closed]
- Check if a field is capitalized?
- Can’t sort custom column on user.php by number / meta_value_num?
- Need to call this php function inside a modal window from text widget
- Add CSS class to posts with certain meta key
- Best way for managing images of ads banners
- Crop custom image size vs actual size