Tag: move

  • Self Pings: What are they and do you need to turn them off?

    Self Pings: What are they and do you need to turn them off?

    What is a Ping/Pingback?

    By default, WordPress enables the ability to perform pingbacks. Basically, when another site references yours, you’ll be sent a “pingback” – a confirmation that this has happened, which is logged on your site similar to a post comment.

    Read more about Pingbacks.

    Can I turn them off?

    Yes, you can. In WP Admin, head into Settings -> Discussion -> Default post settings. Untick the box marked Allow link notifications from other blogs (pingbacks and trackbacks) on new posts. Click the “Save Changes” button and you’re all done.

    Note, however, that this only works for any new posts and not existing. For those, you have to go into the post and, assuming you’re using the block editor, click on the Post tab in the right-hand sidebar, scroll down to the Discussion section and untick Allow pingbacks & trackbacks before updating.

    To do this en-masse you’ll need to look for a plugin or be handy with WP-CLI.

    What are self pings?

    Self pings are when you link to a page on your site and receive a pingback for it. They can be a nuisance and, let’s be honest, aren’t needed.

    You can turn them off with a simple script. The following code, for example, will do just that if added to functions.php

    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' );

    The downside is the sheer simplicity of this solution…

    1. It runs before pings are sent out
    2. It goes through the intended pings and looks to see if they’re referring to the current site. This is based on what’s been defined in the site settings as the Home URL
    3. If the URL is this site, the ping is removed

    Sounds good, yes? But this doesn’t take into account any SSL changes. If your site has old content referring to the non-SSL URL of your site, this won’t work. In addition, if you change your site URL at all at any point, it won’t take that into account.

    It’s been raised as something that needs changing in WordPress Core but they’ve said a firm “no”. “Pings should simply work” and, most importantly, “there’s already a plugin for it”.

    That plugin is No Self Pings.

    The No Self Pings Plugin

    No Self Pings, available for free and with no premium upsell, will turn off all the self pings as well as additional features on top.

    For example, will allow you to add additional URLs into the mix. These can be non-SSL version of your site URL, old URLs or even the URLs of other sites you own that you may not want self-pings for.

    Here’s how it looks in the Settings…

    In future, I intend to update this so that SSL doesn’t even need to be taken into account – both SSL and non-SSL versions of the current or any other site mentioned in the above settings will be considered.

    A quick history of the No Self Pings plugin

    No Self Pings was written by Michael D. Adams, aka mdawaffe, 17 years ago. However, after 2 updates, development stopped.

    I was a user of the plugin myself and, 5 years ago, with SSL issues being reported, I forked the plugin to fix the issues myself. I approached Michael to ask if I could take it over, which he kindly agreed to.

  • The lazy persons guide to contributing to WordPress Core

    The lazy persons guide to contributing to WordPress Core

    I’ve spoken in the past about how easy it is to contribute to WordPress, whether editing videos, writing documentation or one of many different things that don’t require you to be a development whiz.

    But what if it’s the core WordPress product that you do want to help with but you find the thought of it too hard? Well, I’m going to share few simple ways to get involved from zero to limited required development skills.

    (more…)
  • ChatGPT and why you shouldn’t use it for coding

    ChatGPT and why you shouldn’t use it for coding

    I’m trying to make some changes to one of my WordPress plugins and, for reasons that I’m finding maddeningly frustrating, it’s not working.

    So, I thought I’d try ChatGPT to see if it could work out the cause. Here’s how it went…

    (more…)
  • How WordPress works with nonces

    How WordPress works with nonces

    If you’re British, you probably just spat out your tea.

    If you’re not, and know your WordPress, then this post title may seem perfectly innocent.

    Because WordPress has a language problem.

    (more…)
  • 5 things all WordPress plugin developers should be doing

    5 things all WordPress plugin developers should be doing

    Today, I’m going to document 5 things that I think WordPress plugin developers should be doing, if they’re not already.

    And there may be some controversial choices here, particularly for those who develop premium plugins. One of the most popular plugins, for example, fails every single one of these.

    (more…)