X

BLOG

WP Code Tip: get array of post IDs

A number of times over my years developing in WordPress I've needed to extract the post IDs of the posts…

Mervyn Booth

Use PHP’s in_array() to compare a variable to multiple values

When comparing a variable with multiple values consider using in_array(), instead of complex if expressions. I love clean, easy-to-read code,…

Mervyn Booth

How to reindex spotlight on macOS to stop it closing after a few characters

This post is a somewhat off-topic, but for all those of you that are working on Macs, here's a little…

Mervyn Booth

Setting up PHP composer

This article walks through the simple steps for setting up composer. Initially at project level, then, optionally, at the global…

Mervyn Booth

How to fix ansible/vagrant ERROR! the role ‘swapfile’ was not found

This article provides a simple fix for the ansible error, "sorry, tersmitten.swapfile was not found", by updating 1 (maybe 2?)…

Mervyn Booth

How to fix macOS usr/local is not writable

This simple post should fix the "usr/local is not writable" issue with homebrew. Whilst on holiday I needed to use…

Mervyn Booth

How to prevent Yoast from setting noindex on pages

On a few occasions Yoast has inexplicably injected a noindex meta tag in the head of pages that I want…

Mervyn Booth

How to call wp_get_attachment_image() without srcset

Sometimes it's nice to have all the goodies wrapped up in a nice little function, such as wp_get_attachment_image(). This is…

Mervyn Booth

A simple filter to hide specific widgets on specific pages

It's not uncommon to only want to show specific sidebar widgets or footer widgets in certain views. In the case…

Mervyn Booth

How to disable directory views with a blank file or a single line of code

By default the directories (folders) of your website and other applications may be publicly viewable for all to browse. This…

Mervyn Booth

This website uses cookies.