add_action('save_post', 'my_function');
此挂钩仅在从帖子页面提交帖子时有效我想在人员选择快速修改和更新帖子时添加操作。
答案 0 :(得分:1)
我刚刚删除了我之前的回答,因为我意识到自己错了。您应该可以挂钩save_post
进行快速编辑。
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;
}
}
}
此处提供更多信息:https://codex.wordpress.org/Plugin_API/Action_Reference/save_post