Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
Last active October 14, 2021 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtmujeebu/0911cfd87467890628622d552bfb112f to your computer and use it in GitHub Desktop.
Save wtmujeebu/0911cfd87467890628622d552bfb112f to your computer and use it in GitHub Desktop.
Speed up WP insert post by removing all post insert actions
<?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