Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
Last active July 7, 2024 10:55
Show Gist options
  • 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