This runs your function right after the post has been saved (created/updated):
add_action('save_post','clean_data_while_saving_post',1);
function clean_data_while_saving_post($post_id) {
$data = get_post_meta($post_id,'book_isbn',true);
update_post_meta($post_id,'book_isbn',clean_isbn($data));
}
Related Posts:
- Hooking new functions to actions + passing parameters
- WordPress redirect redirecting too many times or not at all
- How to pass hook variable to function?
- Hook into all password resets in WordPress and get password before hashing?
- WordPress HTML Helper
- Is there a hook that I can use when a fatal error occurs?
- what is correct way to hook when update post
- Function to return true if current page has child pages
- Enforcing password complexity
- WordPress and event-driven programming – what is it about?
- Cleaning up WordPress to improve performance?
- List of all theme customizer control types?
- Receiving Stripe Webhooks on a wordpress website
- Check php version before theme activation
- How to preserve PHP modifications while upgrading WordPress?
- Change the footer text on the login page
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- How to remove a metabox from menu editor page?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Can i check if user is doing any ajax request?
- Check if page parent has certain template
- Change comments form title on a page by page basis
- How to Remove a Filter from the Admin List Table?
- Setting up the child theme so as to enable right-to-left WordPress?
- delete an array element when its date expires
- How to add default images into theme customizer image control?
- Find variables available at a given hook
- Why do filters/actions require an argument count?
- Is $hook a global variable in WordPress
- Overriding a theme redux file in child theme
- Delete option value from array using update_option()
- Insert all post IDs in new database table
- How to break down importing of feeds
- How to access function from outside of a class within this class in WP plugin?
- action hook wp_head higher priority as all other plugins/hooks
- How to use return in my custom function instead of echo
- PHP can I add line numbers to file_get_contents()
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Setting custom canonical urls
- Handling Body class based on Template
- Adding Default Settings to Theme My Login plugin
- Remove an action hook within a Class
- How to pass arguments to add_action() or retrieve return value of called function?
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- add_action shortcut?
- Converting HTML Template to WordPress Theme
- How to check if a meta value has already been assigned to any user?
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Trying to build simple deposit code that hooks into woocommerce
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- How to pick the default selected value in wordpress dropdown?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Why ajax doesn’t work on certain wordpress hooks?
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- user_profile_update_errors hook not executing
- Set meta field to publish date + 2 weeks
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Return a numerical function value in Customizer controls
- Adding widgets to my plugin page instead of WordPress dashboard
- Adding function to Genesis genesis_header [closed]
- how to make custom ajax handler?
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Need help enqueueing webfonts
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- jQuery code not working when included in functions.php
- Should `wp_login` be used since it’s deprecated?
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Override a function defined in wp-includes/comment-template.php
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Get original value in save_post action hooka
- Discount in the specific product title using keyword ( Woocoommerce )
- How do I get the value of a current user’s custom field?
- How do I remove an action hook inside a class that is called by another class?
- Remove node from multisites?
- Automatically refresh page if widget is added to page?
- Getting page / post URL on publish and / or update
- remove_action() not working in page template – Genesis
- Unable to pass arguments to function used in add_action
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Why transition_post_type hook is called twice for the same post?
- Add two or multiple functions in WordPress Post or Page
- Where can I find the declaration of `$_wp_theme_features`?
- How do I routinely extract the thumbnail of the most recent post?
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Check if values exists DB
- Highlight posts currently being edited on multiple editor site?
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Display a list of users with avatar filterable with alphabets
- How to add custom checkout field in user details mail template
- Cannot modify header information – headers already sent
- Select area and checkbox data is not saving?
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- WP Custom tables query