get_to_ping()获取当前文章所有需要Ping的网址

目录

描述

译文

检索需要被引用的URL

原文

Retrieve URLs that need to be pinged.

get_to_ping() 描述

用法

<?php get_to_ping$post_id ?>

get_to_ping() 用法

参数

$post_id

(integer) (必填) Post ID

默认值: None

get_to_ping() 参数

返回值

(array) 

Returns array of URLs that need to be pinged.

get_to_ping() 返回值

注意

  • 使用到 global: (object) $wpdb to read 'to_ping' field from _posts table from database.
  • 使用到: apply_filters() on 'get_to_ping' on the URLs that need to be pinged.

get_to_ping() 注意

历史

添加于 版本: 1.5.0

get_to_ping() 历史

源文件

get_to_ping() 函数的代码位于 wp-includes/post.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * 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 );
}

get_to_ping() 源文件