admin管理员组文章数量:1317360
I'm trying to trigger a specific action when a custom post type that I've created is created/updated.
Ideally, I could run the same function/process of whether the post is:
- Created using the New Post screen in the WP Admin
- Updated using the Edit Post screen in the WP Admin
- Updated using the Bulk Edit function that I've created
- Updated using a Quick Edit
I've reviewed and experimented a bit with:
save_post_{custom_post_type}
pre_post_update
handle_bulk_actions-edit-{custom_post_type}
The save_post
hook would work except on a bulk update it appears it only gets called once with one post.
The handle_bulk_actions-edit
would work and I can iterate over the IDs provided but that excludes editing posts manually on the post edit screen, etc.
I also looked at update_{$meta_type}_metadata
as that hooks on specific metadata fields, but that seems like a hack given I really need it on the post level.
Is there one hook that gets called on ANY post add/edit that I can use regardless of the source of the edit (post edit screen, bulk edit, quick edit)? Or what is the best way to handle it?
本文标签: hooksCustom Post Type action on post update
版权声明:本文标题:hooks - Custom Post Type action on post update 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741999581a2410735.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论