Reputation: 108
add_action('save_post', 'my_function');
This hook only works when submitting a post from post page I want to add action while person select quick edit and update a post.
Upvotes: 0
Views: 2821
Reputation: 6537
I just erased my previous answer because I realized I was mistaken. You should be able to hook save_post
for quick edits.
add_action( 'save_post', 'Func_Speaker_Save', 10);
function Func_Speaker_Save( $post_id ) {
if (get_post_type($post_id) == 'custom') {
// Place code here...
switch (get_post_status($post_id)) {
case 'publish':
// A published post or page
break;
case 'pending':
// post is pending review
break;
case 'draft':
// a post in draft status
break;
case 'auto-draft':
// a newly created post, with no content
break;
case 'future':
// a post to publish in the future
break;
case 'private':
// not visible to users who are not logged in
break;
case 'inherit':
// a revision. see get_children.
break;
case 'trash':
// post is in trashbin
break;
}
}
}
More information here: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
Upvotes: 1