Last active
November 20, 2023 14:12
-
-
Save interactiveRob/01a1edf0319e77e9b93387244a8a1c82 to your computer and use it in GitHub Desktop.
Wordpress run function when post is saved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('save_post', function($post_id, $post, $update){ | |
| if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {// ignore autosave | |
| return; | |
| } | |
| if (!$update) { // ignore Add New post | |
| return; | |
| } | |
| //do something -- | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment