Publish Confirmation For WordPress Classic (2023)


Screenshot of a page asking for confirmation before publishing.

Here's a quick scrap of code that works. There are lots of outdated tutorials out there for old versions of WordPress. This one is tested to be working in WordPress 6.3.2. This will pop up a confirmation dialogue when you try to publish, update, or schedule a post or page. The Code Add this to […]

Continue reading →

Find WordPress featured images with no alt text


The Logo for WordPress

WordPress allows you to set a featured image - called a "thumbnail" in the API. This gives a single image which can be used on a listing page, or shown when a post is shared on social media. The WordPress Media Library lets you set the alt text of an image. But, crucially, this alt […]

Continue reading →

Find the URl causing your WordPress Error


The Logo for WordPress

PHP has some pretty good error handling and logging, but I do sometimes find it confusing. For example, look at this warning message: [18-Oct-2023 12:34:56 UTC] PHP Warning: Something bad happened in /wp-content/something.php on line 123 OK, so we can go to something.php and scroll to line 123 and try to figure out what's gone […]

Continue reading →

Displaying internal linkbacks on WordPress


Screenshot of my website. The headline says "What links here from around this site." Underneath are three links.

I have written a lot of blog posts. In some of those posts I link to other posts on my site. What's the easiest way of displaying those internal incoming links? Here's what it looks like: Code All we need to do is search WordPress for the URl of the current page. Loop through the […]

Continue reading →

Making a better audio shortcode for WordPress


The Logo for WordPress

If you use WordPress, you can get a fairly basic embedded audio player by using the audio shortcode: [audio mp3="/path/to/file.mp3"] I didn't particularly like how it was styled so - because WordPress is so hackable - I changed it! Now my embedded audio looks like this: It gets a nice border, a title, displays any […]

Continue reading →

Use WP CLI to find all blog posts without a featured image - two methods


The Logo for WordPress

This uses the wp shell command. It gives you an interactive prompt into which you can do various WordPress "things". One small annoyance is that it doesn't like multi-line entry. It treats every hit of the enter key as "plz run the codez" - so, at the end of this blog post, I've put the […]

Continue reading →

Rewriting WordPress's JetPack Related Posts Shortcode


The new layout has 4 items, each boxed off, with a larger image and more distinct text.

I like the JetPack related post functionality. But I wanted to customise it far beyond what the default code allows for. So here's how I went from this: To this: Documentation The complete documentation for related posts is pretty easy to follow. This is an adaptation of "Use Jetpack_RelatedPosts_Raw to build your own list of […]

Continue reading →

Improving the WordPress Comments Form with Client-Side Validation


The Logo for WordPress

If you use WordPress's HTML5 comments, there's an annoying little gotcha. There's a four year old bug which prevents client-side form validation. HTML allows <input> elements to have a required attribute. In theory, that means the form shouldn't submit until the input is filled in. Sadly, WordPress uses novalidate on the form - as the […]

Continue reading →

Better Bluetooth Sound Quality on Microsoft Teams in Windows 11


Screenshot of a Windows setting screen.

Here's the problem: the current Bluetooth spec doesn't allow high-quality audio to be sent to a headset when it is also sending audio from the microphone. Instead, it switches to the Hands Free Profile (HFP) which only streams low quality mono sound. It makes Teams calls sound like garbage. The usual solution in Google Meet, […]

Continue reading →

How to use the new <search> element with WordPress


The Logo for WordPress

There's a new HTML element in town! You can now use <search> to semantically mark up a search box. It's great for letting screen-readers and other assistive tech know what a form does. It's only supported in WebKit for now - other browsers will get it eventually. The WordPress default search widget hasn't yet updated, […]

Continue reading →