get_to_ping() WordPress Function

The get_to_ping() function in WordPress is used to retrieve a list of URLs that the current post is set to ping. This function can be useful for debugging or for displaying a list of sites that your post will be sent to when it is published.

get_to_ping( int|WP_Post $post_id ) #

Retrieve URLs that need to be pinged.


Parameters

$post_id

(int|WP_Post)(Required)Post Object or ID


Top ↑

Return

(string[]|false) List of URLs yet to ping.


Top ↑

Source

File: wp-includes/post.php

function get_to_ping( $post_id ) {
	$post = get_post( $post_id );

	if ( ! $post ) {
		return false;
	}

	$to_ping = sanitize_trackback_urls( $post->to_ping );
	$to_ping = preg_split( '/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY );

	/**
	 * Filters the list of URLs yet to ping for the given post.
	 *
	 * @since 2.0.0
	 *
	 * @param string[] $to_ping List of URLs yet to ping.
	 */
	return apply_filters( 'get_to_ping', $to_ping );
}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0$post_id can be a WP_Post object.
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More