Last active
July 7, 2024 10:55
-
-
Save wtmujeebu/0911cfd87467890628622d552bfb112f to your computer and use it in GitHub Desktop.
Speed up WP insert post by removing all post insert actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Please do not copy this line | |
add_action('admin_init', 'wt_remove_all_post_insert_actions'); | |
function wt_remove_all_post_insert_actions() { | |
$actions = array( | |
'save_post_product', // WooCommerce product insert | |
'wp_insert_post', | |
'save_post', | |
'add_attachment', | |
'transition_post_status', | |
'pre_post_update', | |
'edit_attachment', | |
'edit_post', | |
'post_updated', | |
); | |
foreach ($actions as $action) { | |
remove_all_actions($action); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment