Created
July 8, 2013 15:49
-
-
Save MartinL83/5950017 to your computer and use it in GitHub Desktop.
Custom Post Type Publish Action Hook.
Original code: http://www.wphub.com/custom-post-type-publish-action-hook/
This file contains 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
// function to be executed when a custom post type is published | |
function run_when_post_published() | |
{ | |
// your function code here | |
} | |
// replace {custom_post_type_name} with the name of your post type | |
add_action('new_to_publish_{custom_post_type_name}', 'run_when_post_published'); | |
add_action('draft_to_publish_{custom_post_type_name}', 'run_when_post_published'); | |
add_action('pending_to_publish_{custom_post_type_name}', 'run_when_post_published'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment