Table of Contents
The technical steps first, then the explanation,
We will remove WordPress ping backs with this tutorial.
With this blog post I assume you have a Child theme, if you don’t please Google a Child theme in WordPress first.
Open your child theme directory in an FTP tool such as FileZilla, or update the files directly in your hosting provider tool.
If a functions.php file already exists, you can open it and edit it. And if it does not yet exist, you can create it in an application such as NotePad-Plus-Plus.
If you already have a functions.php you can proceed to the next code snippet. Copy and paste the following code snippet in your functions.php; and make sure you change the ‘twenty_fifteen’ names to your child theme name.
<?php
//Import parent styles the right way and add other stylesheets if necessary.
function twenty_fifteen_child_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); } add_action( 'wp_enqueue_scripts', 'twenty_fifteen_child_styles' );
Now test if your website is still working, if not check carefully whether the file matches with the code snippet.
<?php
//Import parent styles the right way and add other stylesheets if necessary.
function YOUR_THEME_NAME_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
add_action( 'wp_enqueue_scripts', 'YOUR_THEME_NAME_styles' );
//remove pings to self
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' );
?>
If you have created the functions.php new, it should now look like this.
<?php
//Import parent styles the right way and add other stylesheets if necessary.
function YOUR_THEME_NAME_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); }
add_action( 'wp_enqueue_scripts', 'YOUR_THEME_NAME_styles' );
//remove pings to self 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' ); ?>
Should I remove the self-pingbacks in WordPress?
When starting this blog, it was not yet clear to me how SEO worked and how you could get higher up in Search Engines such as Google.
More and more things started to align such as using the keywords in your content, but also self-pingbacks to a page that had added value or comparable content.
Unfortunately, these self-pingbacks came between the WordPress comments. I didn’t think that looked nicely, so I wanted to remove WordPress ping backs.
Do I have to remove them then?
I leave that up to you. I delete them because I don’t like it, but an extra link can’t hurt.
Summary
I have reviewed this blog post and I no longer think that the content is very relevant, but because this post has been popular and some may still see self ping backs on their own website, I keep the blog post for now.
Original post is from 21 December 2015.