Best Practice to Disable WordPress Self Pingbacks – WordPress Tutorial

By | July 4, 2019

When we are writing our article on wordpress, if we have added some urls of our other articles in our writing article. WordPress will send a Pingback to us.

Please look at below:

wordpress disable self pingbacks

How to disable wordpress self pingbacks?

The best and simpest way is add code below to you theme functions.php.

#disable wordpress self pingbacks
function no_self_ping( &$links ) {
	$home = get_option( 'home' );
	foreach ( $links as $l => $link )
		if ( 0 === strpos( $link, $home ) )

add_action( 'pre_ping', 'no_self_ping');

Leave a Reply

Your email address will not be published. Required fields are marked *