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
- Global update of records after import WP All Import Pro
- Why does my custom slug only show in Gutenberg editor after page refresh?
- Parse error: syntax error, unexpected end of file
- Troll the hackers by redirecting them
- PHP in CSS file?
- How would I use this filter to change the output of the date format to “Twitter time”?
- WP Business Directory Manager Plugin Admin Listings?
- Putting php inside an echo php shortcode
- Add login hyperlink to secondary navigation menu
- Warning: Illegal string offset on theme options page [closed]
- How do I get an external php page to load using javascript
- Help getting previously visited pages ID
- How do I create a numbered list with PHP? [closed]
- Why in my theme I can’t see all the statics content under the posts?
- Woocommerce display one random product via php
- Display all pages – in order
- What does $_GET[‘iphone’] do?
- Change url tag name
- Backend of the WordPress.com [closed]
- Conditional using get_the_ID() not working [closed]
- Appended comments but they show up above the content instead of below
- get_template_directory adding FTP root folders in urls
- Custom ajax call returns 0 [duplicate]
- How to solve Woocommerce Memory Limit
- Metabox Not saving data
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Hide image if taxonomy term is empty
- Fatal error: Call to undefined function register_new_user()
- Shortcode to find and replace URL
- Remove the More Link
- Why is my str_replace not working on short code submitted by front-end?
- Detecting if parent page has gallery
- Skip foreach loop
- Displaying posts based on category
- stripping tags from excerpt in WordPress is not working
- Prev/Next Links Broken on Static Front Page Pagination
- Pagination broken on is_front_page()
- Changing the color scheme based on the url visited
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Mixing variables into an array when inserting values
- Don’t show certain div on front page?
- Could use some help with Shortcodes
- How to integrate noimage picture in this code
- Javascript not loading on certain page
- Location of core code for database connection and get_header
- Deleting Certain terms from appearing on the front end as links
- get comment data using comment id
- meta box not display data input in the textarea
- Clickable image link sends people to wrong URL
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- php include not working in custom page
- How to modify the default feed via a function
- How do I display offsite database info on my wordpress site?
- Styling the second sidebar
- first instantiated SimplePie object cosumes 5mb?
- Adding a line of text to php code
- If ‘editor’ is empty, then
- Different Subdomain changes page content
- Theme not calling Jquery properly
- customize wordpress database error page
- Removing the comment function within wordpress
- Creating Database Table vs. Adding MetaData to Post & User