If you are using the save_post action hook; then you can prevent the code from executing during an autosave with the following conditional:
function do_not_autosave( $post ) {
// Check to see if we are autosaving
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
// Rest of the code here
}
add_action( 'save_post', 'do_not_autosave');
Related Posts:
- trigger save_post event programmatically
- Wp_update_post: Infinite loop even with remove_action solution, OOP
- Is it possible to save/modify a post without calling the “save_post” action hook?
- Returning ACF custom field from publish_post
- How to check what kind of saving it is?
- How to catch and modify custom field values when a page is updated
- save_post hook to add terms getting deleted when using bulk edit
- ‘save_post’ hook not working in WP 3.5
- Add action save post when create and publish
- remove_action(‘save_post’) in function that was triggered by save post not working
- set_post_format called after wp_update_post when using bulk edit?
- WordPress save_post hook not firing when checking if _GET[‘post’] is set
- How do I set a custom post type Category after import using wp_set_post_terms
- Show admin notice if metabox field is empty during save post
- update ACF field when saving post on back office
- Is there a save_post hook for custom post types?
- Where is the right place to register/enqueue scripts & styles
- Difference between do_action and add_action
- Difference between after_setup_theme and init action hooks?
- get $post in init filter or action?
- How to intercept a 404 error
- Move excerpt meta box to above content editor
- Trigger custom action when setting button pressed
- Which hook if user profile information is updated?
- Are hooks called synchronously?
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Disable block from editor based on post type
- WP Rest API – Upload media without saving attachment post
- Difference between hooks Plugin_loaded and admin_int?
- Hook/notify when any option or setting is added or updated
- Which hooks is this? add_action(‘wp’,
- Make W3 Total Cache “Empty All Caches” function purge varnish [closed]
- admin_notices after register_uninstall / deactivate_hook
- How to inject content after
- Better post meta efficiency?
- How to debug removal of rewrite rule flushing?
- function ‘wp_enable_block_templates’ not found
- How can I add a default description to uploaded files?
- Hook Widget to Woo Theme in functions.php
- Security around save_post hook
- How to pass arguments to add_action() [duplicate]
- How to use the post_updated hook before and after arguments
- save_post hook not triggered in WP v3.6.1
- I don’t understand why I shoud use lostpassword_url hook?
- How to get session token of current user in wp_login hook?
- wp_login Action hook with conditional tag
- Hook any php file into the wordpress api
- WP CLI Get all Enqueued Scripts and Styles
- Delay an action until current action is completed
- How to properly setup an activation hook
- How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme
- Help to change the text for new website notification (wpmu_welcome_notification)
- How to remove query string from current page URL?
- Plugins rewrite rules the right way
- Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter
- Add nofollow to custom widget posts
- Change Password Confirmed Email Text
- Register form: add custom field BEFORE default fields
- Custom Front End Registration – How Does the Key work in the Password Set Request?
- Lock user information once fields have been filled in
- What is the difference between add_action and add_filter [duplicate]
- load-* hook for dashboard
- How do I prevent term from being created on create_term hook?
- Hook function prints output twice
- Add Different Actions To Different Page’s wp_footer
- Getting the post ID in parse_query
- How to register a widget when saving a post?
- Remove genesis_404 hook from genesis_loop [closed]
- What hooks do I need to hook into to capture ever wp_user creation/change?
- Is there a before_save_post hook or something similar
- Neccessary to call add_submenu_page and add_menu_page from admin_menu hook?
- Adding custom Bulk Actions
- Print results of a WP_Query to wp-admin/upload.php within ‘delete_attachment’ hook?
- Is there a way to Insert a post to post list?
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- Is it likely that do_action will have unexpected results?
- How to export category name and category link in wordpress json
- Error later wordpress 5.3.2 update. Please help
- How to abort a save operation with a WordPress hook?
- wp_get_current_user Not working
- is_page not triggering
- admin_post_(action) hook create console log error
- Check if front page within function passed to action
- Hook after creating a post and retrieve infos from this post immediatly
- $new_pass always returns null – password_reset hook
- How to resolve 500 error in post listing page?
- Object oriented programming, add_action in constructor not firing
- Get new (not old) post inside transition_post_status hook
- How to Show Different Information to your authors/contributers
- Cannot override hooks.php
- Removing action from template class
- Remove “enqueued” script from array
- Function is Missing an Action Hook
- How to access variables in the function where apply_filters() is called?
- How to change Akismet commenter privacy notice?
- How To Apply Different Styles To All Blocks Based on Post Meta Value?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- Callback API for getting response from fygaro payment gateway
- Changing login url