WordPress action hook · part of WordPress core
wp_insert_post
A WordPress core action that 32 plugins also fire themselves, running on 546K+ sites between them.
“This action is documented in wp-includes/post.php”
How to use wp_insert_post
It's an action: your callback runs at that point and receives 3 arguments. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'wp_insert_post', function( $ID, $post, $arg3 ) {
// Your code runs here.
}, 10, 3 );Argument names come from Page Builder by SiteOrigin's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
32 plugins that fire wp_insert_post
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Page Builder by SiteOrigin400,000+ installs
do_action( 'wp_insert_post', $post->ID, $post, true )inc/admin.php:1280 -
WP All Import100,000+ installs
do_action( 'wp_insert_post', $pid, $post_object, $is_update )models/import/record.php:4196 -
Editorial Calendar20,000+ installs
do_action( 'wp_insert_post', $edcal_postid, $post, true )edcal.php:1356 -
Royal MCP10,000+ installs
do_action( 'wp_insert_post', $post_id, $post, true )includes/MCP/Support/Post_Write_Hooks.php:59 -
Admin Management Xtended5,000+ installs
do_action( 'wp_insert_post', $postid, $post )admin-management-xtended.php:179 -
WSP MCP3,000+ installs
do_action( 'wp_insert_post', $post_id, $post, true )includes/abilities/yoast.php:50 -
Seamless Donations is Sunset2,000+ installs
do_action( 'wp_insert_post', $post_ID, $post, $update )inc/utilities.php:1806 -
BrikPanel: WooCommerce Dashboard & Analytics, Abandoned Cart Recovery, Order Export, Inventory Management & Bulk Editor1,000+ installs
do_action( 'wp_insert_post', $saved_id, $post_obj, true )front-end/products/brikpanel-product-editor.php:10714 -
WP Sync for Notion1,000+ installs
do_action( 'wp_insert_post', $existing_object_id, get_post( $existing_object_id ), true )modules/post/class-notion-wp-sync-post-importer.php:205 -
Air WP Sync1,000+ installs
do_action( 'wp_insert_post', $post_id, get_post( $post_id ), true )modules/post/class-air-wp-sync-post-importer.php:171 -
Expiring Posts1,000+ installs
do_action( 'wp_insert_post', $post->ID, $post )expiring-posts.php:412 -
Oasis Workflow600+ installs
do_action( 'wp_insert_post', $post->ID, $post, true )includes/class-ow-process-flow.php:1098 -
TMDS400+ installs
do_action( 'wp_insert_post', $post_id, $post, $update )includes/class/tmds-products-table.php:478 -
WordLift300+ installs
do_action( 'wp_insert_post', $post->ID, $post, true )admin/wordlift-admin-save-post.php:104 -
Web Directory plugin Free300+ installs
do_action( 'wp_insert_post', $post_id, $post, true )core/classes/listings/listing_form_assets.php:891 -
WPMelon Advanced Bulk Edit for WooCommerce300+ installs
do_action( 'wp_insert_post', $post->ID, $post, true )includes/Handlers/WP_Save_Hooks_Handler.php:258 -
MEGA AI200+ installs
do_action( 'wp_insert_post', $post_id, $post_after, true )mega.php:8895 -
ChinaDS100+ installs
do_action( 'wp_insert_post', $post_id, $post, $update )admin/taobao-products-table.php:476 -
HANDMADE40+ installs
do_action( 'wp_insert_post', $post_id, $post, $update )includes/class/handmade-products-table.php:478 -
Depublish Posts30+ installs
do_action( 'wp_insert_post', $post->ID, $post, true )src/Post.php:96 -
CBIAStudio BlogFlow with AI20+ installs
do_action( 'wp_insert_post', $post_id, get_post($post_id), true )includes/integrations/yoast-legacy.php:154 -
Post ID Optimizer10+ installs
do_action( 'wp_insert_post', $post_ID, $post, $update )post-poidopt.php:3968 -
Dynamic Functionalities10+ installs
do_action( 'wp_insert_post', $post_id, $after, true )includes/features/class-link-health-editor.php:241 -
ProRank SEO10+ installs
do_action( 'wp_insert_post', $id, $after, true )includes/Core/Content/PostContentWriter.php:79 -
Vacation Rentals10+ installs
do_action( 'wp_insert_post', 'wp_insert_post' )assets/rental/frontend/class-edit-rental.php:113 -
CRAI Content UpdaterFewer than 10 installs
do_action( 'wp_insert_post', $original_id, $updated_post, true )includes/class-crai-updater.php:1368 -
Your SEO SquadFewer than 10 installs
do_action( 'wp_insert_post', $id, $post, true )your-seo-squad.php:1708 -
PerfLocaleFewer than 10 installs
do_action( 'wp_insert_post', $post_id, $after, true )src/Translation/PostSlugCheck.php:144 -
ZeopilotFewer than 10 installs
do_action( 'wp_insert_post', $id, $post, true )conditional-content.php:197 -
show.fm Podcast PlayerFewer than 10 installs
do_action( 'wp_insert_post', $post->ID, $updated, true )includes/class-migration-swap.php:169 -
Super Speedy Imports LiteFewer than 10 installs
do_action( 'wp_insert_post', (int)$post_id, $post, (bool)$is_update )tools/class-save-posts-tool.php:95 -
IPS Order Media CleanupFewer than 10 installs
do_action( 'wp_insert_post', $object_id, $post, true )includes/classes/Media/Recovery/ReferenceJournal.php:66
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.