返回介绍

_publish_post_hook()

发布于 2017-09-11 13:35:00 字数 1977 浏览 1438 评论 0 收藏 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_publish_post_hook( int $post_id )

Hook to schedule pings and enclosures when a post is published.


description

Uses XMLRPC_REQUEST and WP_IMPORTING constants.


参数

$post_id

(int) (Required) The ID in the database table of the post being published.


源代码

File: wp-includes/post.php

function _publish_post_hook( $post_id ) {
	if ( defined( 'XMLRPC_REQUEST' ) ) {
		/**
		 * Fires when _publish_post_hook() is called during an XML-RPC request.
		 *
		 * @since 2.1.0
		 *
		 * @param int $post_id Post ID.
		 */
		do_action( 'xmlrpc_publish_post', $post_id );
	}

	if ( defined('WP_IMPORTING') )
		return;

	if ( get_option('default_pingback_flag') )
		add_post_meta( $post_id, '_pingme', '1' );
	add_post_meta( $post_id, '_encloseme', '1' );

	if ( ! wp_next_scheduled( 'do_pings' ) ) {
		wp_schedule_single_event( time(), 'do_pings' );
	}
}

更新日志

Versiondescription
2.3.0Introduced.

相关函数

Uses

  • wp-includes/cron.php: wp_next_scheduled()
  • wp-includes/cron.php: wp_schedule_single_event()
  • wp-includes/plugin.php: do_action()
  • wp-includes/option.php: get_option()
  • wp-includes/post.php: xmlrpc_publish_post
  • wp-includes/post.php: add_post_meta()
  • Show 1 more use Hide more uses

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文