discover_pingback_server_uri

Advertisement

Summery Summery

Finds a pingback server URI based on the given URL.

Syntax Syntax

discover_pingback_server_uri( string $url, int $deprecated = '' )

Description Description

Checks the HTML for the rel="pingback" link and x-pingback headers. It does a check for the x-pingback headers first and returns that, if available. The check for the rel="pingback" has more overhead than just the header.

Parameters Parameters

$url

(string) (Required) URL to ping.

$deprecated

(int) (Optional) Not Used.

Default value: ''

Return Return

(string|false) String containing URI on success, false on failure.

Source Source

File: wp-includes/comment.php

function wp_defer_comment_counting( $defer = null ) {
	static $_defer = false;

	if ( is_bool( $defer ) ) {
		$_defer = $defer;
		// Flush any deferred counts.
		if ( ! $defer ) {
			wp_update_comment_count( null, true );
		}
	}

	return $_defer;
}

/**
 * Updates the comment count for post(s).
 *
 * When $do_deferred is false (is by default) and the comments have been set to
 * be deferred, the post_id will be added to a queue, which will be updated at a
 * later date and only updated once per post ID.
 *
 * If the comments have not be set up to be deferred, then the post will be
 * updated. When $do_deferred is set to true, then all previous deferred post
 * IDs will be updated along with the current $post_id.
 *
 * @since 2.1.0
 *
 * @see wp_update_comment_count_now() For what could cause a false return value
 *
 * @param int|null $post_id     Post ID.
 * @param bool     $do_deferred Optional. Whether to process previously deferred
 *                              post comment counts. Default false.
 * @return bool|void True on success, false on failure or if post with ID does
 *                   not exist.
 */
function wp_update_comment_count( $post_id, $do_deferred = false ) {
	static $_deferred = array();

	if ( empty( $post_id ) && ! $do_deferred ) {
		return false;
	}

	if ( $do_deferred ) {
		$_deferred = array_unique( $_deferred );
		foreach ( $_deferred as $i => $_post_id ) {
			wp_update_comment_count_now( $_post_id );
			unset( $_deferred[ $i ] );
			/** @todo Move this outside of the foreach and reset $_deferred to an array instead */
		}
	}

	if ( wp_defer_comment_counting() ) {
		$_deferred[] = $post_id;
		return true;
	} elseif ( $post_id ) {
		return wp_update_comment_count_now( $post_id );
	}

}

/**
 * Updates the comment count for the post.
 *
 * @since 2.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $post_id Post ID
 * @return bool True on success, false if the post does not exist.
 */
function wp_update_comment_count_now( $post_id ) {
	global $wpdb;
	$post_id = (int) $post_id;
	if ( ! $post_id ) {
		return false;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.