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
- Enforcing password complexity
- WordPress and event-driven programming – what is it about?
- 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 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?
- Change comments form title on a page by page basis
- 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
- Delete option value from array using update_option()
- 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
- PHP can I add line numbers to file_get_contents()
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- 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
- Converting HTML Template to WordPress Theme
- How to check if a meta value has already been assigned to any user?
- 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?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- 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?
- Adding widgets to my plugin page instead of WordPress dashboard
- how to make custom ajax handler?
- Need help enqueueing webfonts
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- Should `wp_login` be used since it’s deprecated?
- How to obtain the current website URL in my 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
- Run a code only on theme activation only during first activation
- Change order of custom submenu link in WP Admin?
- Plugin Development – Functions or Hooks?
- Theme not calling Jquery properly
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Are there action hooks for comments?
- Why does the post_type_link hook everything twice?
- Create page template via functions.php?
- How to create a field in customize and show that in header.php?
- How to have different site identity logos on each page on Astra Theme [closed]
- Get user custom field value on function.php
- Adding function to child theme’s function.php
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Is there a hack for using is_page() within the function.php file?
- Must filter functions receive all arguments passed to them?
- Creating customized php files in theme folder
- Dynamically Generate Functions and Hooks
- Customize field names in backend profile edit page through function.php [duplicate]
- WP-Bakery – Add custom colors to buttons with template colors
- Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
- How do I add a function to parent theme
- Contain multiple page templates in one PHP custom template file in WordPress?
- Wp_Schedule_Event every few minutes doesn’t work
- update_user_meta as multiple value but with same meta key
- Delete post meta by serialized meta value
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Custom meta box is not displaying value showing tag as empty
- How do I get the value of a current user’s custom field?
- Remove node from multisites?
- Getting page / post URL on publish and / or update
- Unable to pass arguments to function used in add_action
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- 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 can I clear the theme mod settings?
- 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
- Add multiple HTML attributes to an Elementor button
- Why a class property becomes empty?