If you look through the definition of wp_insert_post()
, you’ll see
do_action( 'wp_insert_post', $post_ID, $post, $update );
at the end of it. So you can hook into this and perform whatever task you want to after creating a post.
Something like this in your theme’s functions.php
or in your plugin file:
do_action( 'wp_insert_post', 'send_notification');
function send_notification($post_ID, $post, $update){
//your code here
}
Related Posts:
- Who are the most trusted plugin developers? [closed]
- How Does WordPress Uninclude/Deactivate A Plugin?
- WordPress plugin for mail subscriptions [closed]
- Let user subscribe to specific categories
- Is there a way to alter the order in which the plugins appear in the page?
- How to make a customize role and view a specific plugins base on that role?
- Woocommerce plugin for minimum order and add-to-card-step
- How would I go about creating a user ranked post popularity page?
- Create a plugin from within WordPress
- Can I use Symfony components in a plugin that I want to submit to the WordPress plugin repository?
- How to automatically add edit link on frontpage post of any wordpress theme?
- creating a plug in that would tap into save/update action of posts [closed]
- breadcrumb need to show all pages and subpages
- Possible?? Pull Plugin Property Data to a Theme’s Custom Post Type
- How to use existing hook in twentytwelve to all theme of wordpress?
- How to get Recent Post From Each Category with Thumbnail?
- Personality quiz in wordpress using a plugin
- Access remote SFTP server via WordPress login?
- Create survey that redirects to sidebar menu customized to answers
- How to put a maximum real-time users limit
- Using Taxonomies with Vote It Up plugin chart [closed]
- How can I create a navigation menu in the sidebar that can also act like a slider?
- contact form 7 captcha support anyother captcha plugin? [closed]
- Take Elementor For Email FIeld Check if user is registered. IF not registered then register on woocommerece
- how to make wordpress remember my choice
- I’m getting the following error: Fatal error: Uncaught Error: Call to undefined function oil_paint_regeneration() [closed]
- What are Seeds? [closed]
- How to implement WordPress plugin update that modifies the database?
- WordPress Plugin Development In MVC Architecture, How?
- Customize plugin update “new version is available” text
- category_name not working (not showing up in sql query debug)
- What happens when two plugins have the same 3rd party class included into them?
- add_rewrite_rule, plugin activation and plugin deactivation
- How to handel multiple checkbox field in the admin settings page with Settings API
- Update Multiple Post Meta for the Same Post In One call?
- Allowing Custom Capability to Manage Plugin Options
- wp_insert_user – how to send verification email before logging in
- Custom plugin settings: clicking “save changes” does not display success message
- How can I translate the name of my Plugin for other languages?
- How to load a new template page according to a particular URL?
- How can I filter blog name?
- Logs to check when the plugin was first installed for the first time
- Detect if a plugin was included in a certain page
- Is there a plugin that makes extnernal links open in new window, BUT [closed]
- How to add an attribute to the body tag with a plugin?
- Override the core function locate_template
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- How to get variables from fucntion.php to my plugin files
- Is there any way to get all the name or slug of template parts used in a page?
- What function can I use consistently to escape possible HTML for editing and display?
- First WordPress Plugin – Stat Issues
- Plugin to host auctions on your site
- Test files for plugin development
- Updating the Drag-To-Share eXtended share URLs?
- Send Custom welcome email to specific user group
- WordPress.org Plugin Directory doesn’t recognise screenshots [closed]
- How to check current user before all actions and filters?
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- Is it necessary to auto delete my WP plugin database tables when users deactivate/delete my plugin?
- Namespaced shortcode?
- How to pass variables to a function argument using add_action [duplicate]
- Custom post types – remove default post supports through empty array?
- How to insert and call new data in wordpress website database through a plugin
- How to be escape Variables and options when echo?
- Release the plugin in the WordPress repository where redux is used
- Dokan Marketplace store link in single product page
- Development of plugins to add components like JqueryUI
- plugin enqueue style on all pages
- Using meta_query in a WP_Query not working for numbers properly
- why the wp_register_script doesn’t work for register_activation_hook
- Dynamic Rating Plugin to Add Anywhere
- Use a custom block in another block
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- GitHub plugins safe to use in my website?
- How to copy the all WordPress media items to another custom plugin folder?
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Why is my shortcode not working?
- Link custom post type to page
- implement checkbox or toggle switch in plugin code
- wp_remote_post To external API multiple values with the same key
- wordpress form not saving or updating
- Custom admin plugin read CSV
- Can we rename a plugin directory for a already launched plugin?
- How can I call functions from a custom plugin?
- How to get short description under heading – Visual Composer [closed]
- plugin installing error
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- How to create a new database table whenever user changes options
- Am I correctly adding styles to plugin?
- How can I insert a record into a custom table from my custom form in my custom admin page?
- how to create table during plugin installation in side a class
- WP_Filesystem usage within a block of code
- Why function hooked using object are executing at all time?
- What is the Object for WP_Error Class?
- How can I use multi Media Uploader in a plugin?
- Gutenberg: Dynamic Block – Show saved data in the editor
- Any way to hook into WP after a page displays?
- Publish post facebook page & twitter automatically [closed]
- How can I make my plugin detect if a certain theme is active?
- Pulsing circle before the post title (Breaking news flash)