WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wp_xmlrpc_server::mt_getTrackbackPings() WP 1.5.0

Retrieve trackbacks sent to a given post.

Это метод класса: wp_xmlrpc_server

Хуки из метода
Возвращает

Массив/IXR_Error.

Использование

$wp_xmlrpc_server = new wp_xmlrpc_server();
$var = $wp_xmlrpc_server->mt_getTrackbackPings( $post_ID );
$post_ID(число) (обязательный)

Заметки

  • Global. wpdb. $wpdb WordPress database abstraction object.

Список изменений

С версии 1.5.0 Введена.

Код wp xmlrpc server::mt getTrackbackPings: wp-includes/class-wp-xmlrpc-server.php WP 5.2.3

<?php
public function mt_getTrackbackPings( $post_ID ) {
	global $wpdb;

	/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
	do_action( 'xmlrpc_call', 'mt.getTrackbackPings' );

	$actual_post = get_post( $post_ID, ARRAY_A );

	if ( ! $actual_post ) {
		return new IXR_Error( 404, __( 'Sorry, no such post.' ) );
	}

	$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();
	}

	$trackback_pings = array();
	foreach ( $comments as $comment ) {
		if ( 'trackback' == $comment->comment_type ) {
			$content           = $comment->comment_content;
			$title             = substr( $content, 8, ( strpos( $content, '</strong>' ) - 8 ) );
			$trackback_pings[] = array(
				'pingTitle' => $title,
				'pingURL'   => $comment->comment_author_url,
				'pingIP'    => $comment->comment_author_IP,
			);
		}
	}

	return $trackback_pings;
}