1. 首页
  2. WordPress钩子手册

get_to_ping

apply_filters( ‘get_to_ping’, string[] $to_ping )

过滤器::过滤给定帖子的url列表。
Filter Hook: Filters the list of URLs yet to ping for the given post.

目录锚点:#参数#源码


参数(Parameters)

参数 类型 说明
$to_ping (string[]) 尚未ping的url列表。

源码(Source)

/**
 * Retrieve URLs that need to be pinged.
 *
 * @since 1.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $post_id Post ID
 * @return array
 */
function get_to_ping( $post_id ) {
	global $wpdb;
	$to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
	$to_ping = sanitize_trackback_urls( $to_ping );
	$to_ping = preg_split('/s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);

	/**
	 * Filter the list of URLs yet to ping for the given post.
	 *
	 * @since 2.0.0
	 *
	 * @param array $to_ping List of URLs yet to ping.
	 */
	return apply_filters( 'get_to_ping', $to_ping );
}
更新版本 源码位置 使用 被使用
2.0.0 wp-includes/post.php:4834 1 0

get_to_ping 为WP2原创文章,链接:https://www.wp2.cn/hook/get_to_ping-2/