There’s a hook save_post
, docs here: https://developer.wordpress.org/reference/hooks/save_post/ which will allow you to run some code after the post is saved. Example from there:
function add_user_after_post_save( $post_id ) {
// add a user?
// move the post to the user?
}
add_action( 'save_post', 'add_user_after_post_save' );
Not sure why you’d need to call the hook immediately before the post is created, as anything that you can do then you can also do in the save_post hook, but please provide more information.
Related Posts:
- Allow only 1 taxonomy per custom post type [duplicate]
- Custom plugin: Trying to show saved data on frontend
- Do I require the use of nonce?
- Fatal error: Call to undefined function plugin_dir_path()
- How to make WordPress plugin check for database changes and then do something?
- Retrieve multiple values passed to a single attribute in a shortcode
- How to change date language without changing the entire site language?
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- How to use copy() function and paste file in /wp-content/themes directory
- OOP Plugin Development. Including external object
- Authenticating to WordPress, using my own authentication two-factor system
- wordpress custom endpoint multiple params
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Create table in database when activating plugin
- Problem with WordPress Ajax form
- Am I not understanding plugins?
- Using Font Awesome as post thumbnail
- admin-ajax.php responding with 0
- Page Reloads Before AJAX Request Finishes
- Add htaccess rules with insert_with_markers at beginning of htaccess
- custom shortcode will not display the wrapped content
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- Insert array data on plugin activation
- WordPress php filter admin_body_class not working
- Common abstract class for plugins
- Same log message keeps on printing to debug.log file thousand of times
- Adding Default Settings to Theme My Login plugin
- Append HTML Using Shortcode
- Create onClick Event to Re-load a Widget
- How to select the contents in the text view textrea in wp_editor?
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to sanitize any integer input field in wordpress?
- WordPress ajax doesn’t display object method on jQuery .change() function
- filter default query to show just selected level of child pages in wordpress
- How to make my custom widget appear within WordPress widgets? Plugin development
- How to auto fetch customer details in Woocommerce in checkout page
- Can’t upload image using media_sideload_image
- Adding widgets to my plugin page instead of WordPress dashboard
- How to insert data into database using wp cron job
- I want to add custom add to cart link [closed]
- Execute long and heavy processes
- Access Child Class of Plugin Main Class Instance
- Font Awesome changing default WordPress Font
- Custom plugin settings link doesn’t append current class to menu item when visited? Why?
- Download full html page with CSV export plugin
- How to hook code to show after the_content?
- Using and saving custom dropdown boxes on user profiles
- Problem with AJAX in wordpress plugin
- Usage of call back function of add_meta_box()
- how to save checkbox data for custom setting?
- Can a plugin redirect product page based on IF condition?
- Save html content of a widget textarea
- How to Schedule Cronjobs for start of every month and year
- Why does my settings form redirect to the homepage?
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- How to override a plugins script
- Woocommerce custom Plugin in wordpress [closed]
- Removed jQuery script from header.php , any problems?
- How can I get plugin meta data without knowing the plugin folder?
- calling admin-ajax.php from admin-ajax.php
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- How does add_option() function enable action hooks to fire right after actiavtion?
- Create plugin with custom page and template caused an error `Call to undefined function get_header()`
- Settings API form – submit with AJAX
- Post form – AJAX won’t upload featured image – Plugin development
- Plugin won’t output characters with diacritics properly
- ACF relationship on user profile page used for allowed access
- Store user form submitted information in post type
- Problem with my Login Plugin
- How to return html as a string from php for WordPress
- Sum All the Post Meta of Published posts of Current Logged in user
- Taxonomy Child Term, Counter is staying on 0
- Need help with format of nested array in MySQL
- Autoloading Classes in Plugins
- How to add delete, approve, spam Links to Comments
- Help on Wp_query to print an term
- Comparing Dates within plugin using PHP If statement
- Upload images from one server to an other in wordpress
- Setting at job with shortcode not working
- Run code before WordPress loads and insert data into WP if need be
- Singleton plugin activation; create database
- PHP: Why does my code work in index.php but not a widget?
- How to use Amazon Elastic Transcoder from WordPress using AWS SDK for PHP?
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- How to get WordPress Adminmenu items?
- How keep woocommerce users separeted in multisite install and keep admins on network
- I’m not able to get access $wpdb in my php file in wordpress
- How do I change the Go To Categories link in the term_updated_messages
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Custom taxonomy with page post type – WordPress
- Query posts by custom taxonomy slug in WP REST API?
- oneOf JSON Schema validation not properly working for custom post meta value?
- Too few arguments at registering new templates in my plugin
- I want to lists posts in wordpress to nearest location entered by the user
- Displaying custom meta box value in a custom post page
- how to check elementor is widget is active or loaded
- Create a custom plugin with dynamic child pages listing database records