Categories
Development WordPress

Hello Dolly. Revisited.

The plugin Hello Dolly comes bundled with every WordPress installation and adds a line of the famous to the top of the WordPress dashboard. And it’s not always appreciated.

This is the most useless plugin ever created

Why???

For The Love of GOD, Why is this STILL on the Repo?

…are just 3 of the 1 star reviews for it.

Why is it included? Well, it’s not basically Matt wants everyone to learn the lyrics to one of his favourite songs. No, it’s included as an example of a basic plugin and how anyone can write one. It’s a demo.

But it’s been in the plugin directory for 15 years and probably existed for even longer, with no real updates during this time. And, as a demonstration, it’s now out-of-date. As an example of how to write a plugin, it’s no longer doing its job.

So, as a mini personal project, I’ve decided to bring Hello Dolly up to date. Sadly, I can’t make people love it.

Categories
WordCamp WordPress

WordCamp Europe 2023

WCEU is just a few weeks away, this time coming from the beautiful city of Athens.

And, assuming it doesn’t put you off, I’ll be one of the speakers. My talk has the title of “10 Things WordPress Plugin Developers Should Avoid”. I promise it’s less click-baity than the title suggests.

Tickets are still available.

Categories
Development WordPress

CSS compression script: now open source

Back in 2008 I released an online tool (which was a simple page on this site) for CSS compression. You pasted in your CSS, pressed a button and it compressed it.

However, I never really did much else with it – either improving what it did and what functions it provided, but also promoting it.

Now, I’ve taken the original compression script and open sourced it for everyone to copy, fork, or just generally use.

Categories
Development WordPress

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.

Categories
Development WordPress

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.