wp_auto_approve_ping filter-hookWP 7.1.0

Filters whether a pingback is approved without being held for moderation.

Defaults to true for pingbacks originating from a published post on the same site, and false for every other pingback. Trackbacks are never considered, as they cannot be verified.

Usage

add_filter( 'wp_auto_approve_ping', 'wp_kama_auto_approve_ping_filter', 10, 3 );

/**
 * Function for `wp_auto_approve_ping` filter-hook.
 * 
 * @param bool   $approve_pingback Whether to auto-approve the pingback.
 * @param int    $source_id        ID of the post on this site the pingback originated from, or 0 if
 *                                 it came from elsewhere.
 * @param string $url              The URL the pingback was sent from.
 *
 * @return bool
 */
function wp_kama_auto_approve_ping_filter( $approve_pingback, $source_id, $url ){
	// filter...
	return $approve_pingback;
}
$approve_pingback(true|false)
Whether to auto-approve the pingback.
$source_id(int)
ID of the post on this site the pingback originated from, or 0 if it came from elsewhere.
$url(string)
The URL the pingback was sent from.

Changelog

Since 7.1.0 Introduced.

Where the hook is called

check_comment()
wp_auto_approve_ping
wp-includes/comment.php 197
return (bool) apply_filters( 'wp_auto_approve_ping', $approve_pingback, $source_id, $url );

Where the hook is used in WordPress

Usage not found.