private_to_published
云策文档标注
概述
private_to_published 是一个 WordPress Hook,在文章状态从私有(private)过渡到已发布(published)时触发。此 Hook 已在 2.3.0 版本中被弃用,建议使用替代 Hook。
关键要点
- 触发时机:当文章状态从 private 过渡到 published 时
- 参数:$post_id(整数类型,文章 ID)
- 弃用信息:自 WordPress 2.3.0 版本起被弃用,应改用 'private_to_publish' Hook
- 相关函数:_transition_post_status() 用于管理未来文章过渡到 published 状态
注意事项
由于此 Hook 已被弃用,开发者在编写新代码时应避免使用,转而使用 'private_to_publish' 以确保兼容性和最佳实践。
原文内容
Fires when a post’s status is transitioned from private to published.
Parameters
$post_idint-
Post ID.
Source
do_action_deprecated( 'private_to_published', array( $post->ID ), '2.3.0', 'private_to_publish' );
Changelog
| Version | Description |
|---|---|
| 2.3.0 | Deprecated. Use ‘private_to_publish’ instead. |
| 1.5.0 | Introduced. |