wp_xmlrpc_server::pingback_extensions_getPingbacks() WordPress Method

The wp_xmlrpc_server::pingback_extensions_getPingbacks() method is used to discover new Pingbacks for a given URL. This is useful when your blog is hosted on a different server than your Pingback source, as it allows you to discover new Pingbacks without having to periodically check the source for new content.

wp_xmlrpc_server::pingback_extensions_getPingbacks( string $url ) #

Retrieve array of URLs that pingbacked the given URL.


Description

Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html


Top ↑

Parameters

$url

(string)(Required)


Top ↑

Return

(array|IXR_Error)


Top ↑

Source

File: wp-includes/class-wp-xmlrpc-server.php

	public function pingback_extensions_getPingbacks( $url ) {
		global $wpdb;

		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
		do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks', $url, $this );

		$url = $this->escape( $url );

		$post_ID = url_to_postid( $url );
		if ( ! $post_ID ) {
			// We aren't sure that the resource is available and/or pingback enabled.
			return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) );
		}

		$actual_post = get_post( $post_ID, ARRAY_A );

		if ( ! $actual_post ) {
			// No such post = resource not found.
			return $this->pingback_error( 32, __( 'The specified target URL does not exist.' ) );
		}

		$comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID ) );

		if ( ! $comments ) {
			return array();
		}

		$pingbacks = array();
		foreach ( $comments as $comment ) {
			if ( 'pingback' === $comment->comment_type ) {
				$pingbacks[] = $comment->comment_author_url;
			}
		}

		return $pingbacks;
	}


Top ↑

Changelog

Changelog
VersionDescription
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