Wednesday, March 8, 2017

How to remove self pings in Genesis

Pingbacks or trackbacks are good in a way to showcase your content popularity. But self pingbacks are irritating when you have comment moderation enable in your setup.

Apart from showcasing pingbacks dont stand any value for SEO. If you want to disable them in your Gensis themes then add below code in functions.php file of child theme.

function no_self_ping( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, $home ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'no_self_ping' );

No comments:

Post a Comment