There is a hook that worked for me in most case while those 3 hooks you use fail. It’s transition_post_status
:
add_action('transition_post_status', 'sterilize_vehicle_information', 10, 3);
function sterilize_vehicle_information( $post, $new_status, $old_status) {
$internet_price = get_field('internet_price',$post->ID);
if( $new_status == 'publish' && old_status != 'publish' ) {
update_post_meta( $post->ID, 'internet_price', preg_replace( "/[^0-9]/", "", $internet_price ) );
}
}
Hope this will help.
Related Posts:
- what is correct way to hook when update post
- Why is my custom meta box input not saving
- Action ‘save_post’ not working for quick edit
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- How can i create a function to get youtube video time
- Second select list values are not saved after clicking update
- Set Primary category using the Yoast SEO plugin
- Insert post without actions/hooks
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Executing `createimagefrompng()` from save_post hook (or equivalent hook)
- phpMyAdmin displays error when importing database
- save imported posts as drafts
- How can I get the total number of installed importers?
- Auto-Select Parent Category as Primary
- Can’t find infinite loop cause
- How to set the WordPress logo programmatically with PHP
- WordPress import media error
- Custom meta box values are not getting saved for my custom post type
- Include style.css in the Child Theme with PHP
- update_post_meta() not saving data inside of save-post filter
- Class property seems to lose scope, attached to save_post action?
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- save_post action inside a custom metabox class not working
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- How to check post meta isset or not empty during publish/save post?
- save_post trigerred twice
- Create “blank” admin page without having admin-bar/admin-menu for faster load
- Import Instagram post as WordPress post
- Pull a div from one WordPress site into another WordPress site
- Importing demo data in Multisite
- Save data of select list after clicking save
- WXR XML import is stripping php tags that I need to keep
- How to extend the page editor?
- Getting invalid user ID error when creating a new user with wp_insert_user
- Creating posts with php-script + csv
- Save_Post change Custom Post Type Post title to post id number
- Running a long script in PHP
- Custom query to get post names beginning with a digit
- Real time Duplicate title check
- How to check from which page the user is coming to the current page?
- Blank on static home page?
- Make custom field meta not display if there is not data in it
- How to make thumbnail image fit into a div where image dimentions are completely different?
- wordpress upgrade has broken my permalinks
- Using get_bloginfo(‘template_directory’) or variable – performance issue
- Word Count Function Preventing Permalink Editing
- How to call function that create table in database (plugin functionality)
- WordPress pagination not working with search page
- Change the CSS of the Customizer API
- Detect session/cookie variable in wordpress to prevent access to documents
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Customizer: active_callback and sanitize_callback incompatibility?
- How to implement a rating and review system for WordPress custom posts?
- Set Order Status to Complete After Payment – from another site
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Hide a div when tags doesnt exist [duplicate]
- Multiple meta_key in one global $wpdb;
- What does -> mean in WordPress?
- Parsing Menu Items and Blog Posts
- First Byte Time (back-end processing)
- How to update and save user metadata on page visits?
- How to optimize update_post_meta?
- Contact Form 7 – Replace database configured form template with a static file
- How to pass argument to add_action while the method is inside a class?
- Generate CSV file and add data as a new wordpress custom post
- Add URL parameter to all internal links using a specific theme
- How can I use a text and a function php
- Call featured image url
- How to make changes to style.php [closed]
- select wordpress custom post type
- WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6
- Unserialize Custom Field & Save as Multiple Rows in WordPress Database
- Modify WooCommerce used to get all orders in dashboard
- Add a product category to a specific product via a button
- WordPress can’t use ZipArchive
- WordPress loading progess – wp-blog-header.php
- Creating a checklist with ACF and I cannot figure out how to add all iterations to an array that I’m creating
- Trying to generate a CSS file in wordpress uploads folder
- register_setting not save checkbox
- Add Product Permalink in woocommerce admin order page
- Proper use of Output Buffer for a whole php clas
- get_template_part() not working with Advanced Custom Fields plugin
- How do I make comment-reply-button with that takes to comment reply form on click
- Allow user to choose header style
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- Not able to add new item in wordpress home page
- views How to load javascript on custom page template?
- How to find the function which is outputting Array
- Contact form field in wordpress menu
- How can I include a file related to blog URL? Nothing seems to work
- How Can I Center the Logo in the Navigation Menu? [closed]
- Sort posts by title, sort array by largest number [duplicate]
- Where are Sessions are being started? [closed]
- Object of class WP_Post could not be converted to string while trying to console.log wp_get_nav_menu_items
- Check radio get value to array
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to create shortcode of this PHP code
- Shortcode Displays 2 times
- Using Featured Image as Hero Background in Word Press