I have not tested this, but my guess is that $_POST
is not set when the post is saved when wp_cron
changes the status from “Scheduled” to “Published”, and so your value gets saved/reset to 0.
Instead of using save_post
you could hook to the several transition hooks that fit your needs.
Or you could remove your action for the one or more transitions that seem to be problematic. For example:
add_action(
'pending_to_publish',
function($post) {
remove_action('save_post', 'k2_feature_meta_save_details');
}
);
Untested, but I hope that helps.
Related Posts:
- Update Multiple Post Meta for the Same Post In One call?
- Comparisson between date() and a date from wp_postmeta
- Show the “ratingValue” and “ratingCount” values of KK Star Ratings Plugin
- Updating post meta for custom post types
- How can I add a custom meta value on file upload?
- How to get custom field image url of specific size
- How do I add advanced custom fields / meta fields to Elasticsearch? [closed]
- Set attached to state
- How to change ID of an attachment in wp_posts and its related tables correctly?
- Add multiple attributes to product from php
- Make the checkbox meta field checked by default
- Where to hook my plugin’s action
- Is there a filter for get_post_custom()?
- dynamically generating plugin syntax
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms? [closed]
- What is generating my meta og:description?
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- How to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin into my page’s recipe ld+json schema
- get current date + 90 days and checking every day
- How can I change the meta_key for a particular piece of information?
- WordPress Post Visibility Options for Frontend
- Bulk update all posts from plugin settings screen
- How to insert multiple postmeta values with one query?
- Mass SQL WordPress Meta Key deletion
- Date format – Meta Box plugin
- get meta value from database by post id
- How to remove bulk actions from custom post type
- Adding custom meta boxes to specified custom post type
- How to select a paragraph other than the 1st to be the post’s excerpt?
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- How can I concatenate variables to search results title? [closed]
- Remember the Meta Value With Radio Buttons
- Link Posts to External URL
- Why does “updated_post_meta” did not fire when uploading media other than image?
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Help to Create a Simple Plugin to make a post
- get_post_meta shortcode returns empty field
- Add an action based on custom post meta field
- how to auto random increment for post view
- How to securely controlling data without keeping it in postmeta?
- “Enable Media Replace” plugin does not update serialized object in WPMeta
- Custom Field used to allow a Free Story; no longer works
- Performance considerations – postmeta table versus new table for custom posts with foreign keys?
- Get and Update Most Meta Value as an array in HTML form
- How to create meta fields with more than 1 relation?
- Get value from an input field and pass into update_meta_data as $meta_value
- How to get post that has non zero or greater than zero meta value
- Delete postmeta when uninstall/delete plugin
- Same Title on two different post type with single custom taxonomy
- How can I make my plugin display custom post meta data on the front end?
- Storing values in Post Meta vs new tables
- Add meta tags with a plugin?
- WordPress User Frontend Editing Custom Fields
- wordpress last all added get meta value by post id
- Get post id in Post Page within Wp-admin
- Output plugin post like system count [closed]
- getting image alt text via ACF plugin in WordPress [closed]
- Update post meta Rest Api
- how to add meta for order in woocommerce
- How to detect WP plugins used on a site
- Login with OpenID, similar to Stack Exchange sites?
- Advanced custom field plugin not showing in admin sidebar
- How to remove action from plugin?
- Sidebar Generator issue [closed]
- Is there a plugin to help with translation of other plugins? [closed]
- How to load default scripts included with WordPress correctly?
- Skip file when plugin updated
- Can I use a Shortcode output as an HTML attribute value?
- Use WordPress with a custom OAuth2 provider
- Is license need for free wordpress plugin
- How to send little data between admin pages of my plugin?
- WordPress multiple pages on one page via button switching
- Redirect already logged in users away from a page to a specific page base on user role
- What can be reason for no plugin-strings available under stable section on translate.wordpress.org?
- External Script Using WP – Hooks / Actions Not Working?
- How to add FB like + share AND also other Social Buttons on ALL pages and posts?
- file-gallery plugin line 1573 broken in 4.2 upgrade [closed]
- PHP Error When a plugin is active
- Moving a plugin js to footer
- Hardcoded paths in my plugin
- Dequeue, Unregister, Remove Action – Not Working on Plugin
- How can recognize post’s category?
- Widget content turns up before title
- How do I fill the Home Description?
- Disable “auto embed” feature when pasting text and links
- Alternative Hook to the_content for Changing Background Color
- How to use WordPress header function and footer function and not load word press database
- I want to display “how many times this tag used in WordPress?”
- Password Protect wp-content?
- How to make cover image in post block expand to entire screen?
- Conditional Fields depending on checkboxes
- Translation plugin with default language?
- wordpress ajax pagination object value does not change
- image upload error wordpress
- OOP Plugin: Where should I place the action hooks in the class?
- Add country flags
- Content expands beyond its column container [closed]
- Change email notification language based on the site language in WPForms