Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth.

Sherlock Holmes

Over the years I’ve learned it’s always my fault. If something isn’t doing what I expect it to, then I’ve messed up somewhere – so I look to my code, and the most recent changes, to see where the problem is.

Read More →

In adapting a twitter feed plugin to my needs, I came across a weird problem where transients wouldn’t save, and worse, it was intermittent. I at last isolated the problem to emojis, and found this post on the subject which explained the problem.

Read More →

One of my Bulk Attachment Download users suggested I make it work for grid view as well as list view, and since this was entirely sensible and something I should have looked at sooner, off I went. Most of the work was relatively straightforward, but I hit a bump when trying to respond to users selecting attachments for download.

Although I could get a jQuery function to react to a click event on the image, nothing would happen when clicking on the check / uncheck icon at the top right of each image.

Read More →

When I’m developing a site I always have an st_error_log( $var ) function that writes to an error log so I can dump variable data there to figure what’s going. On three separate occasions now I’ve had a wtf moment when it seems as though a filter or action has been firing twice for a single page load.

Read More →

A few years back I wrote about how to get Fancybox 1 working on WP galleries – specifically how to add a rel tag to an image anchor tag so that images would appear grouped in their correct galleries.

That all became obsolete with the introduction of the Gutenberg block editor, as images and galleries are now inserted into posts and pages in completely different ways.

Before, there were plenty of filters available to change image and wrapping anchor tags relatively easily, but my attempts to do something server-side and php-based with the block editor met with total failure. Instead I ended up upgrading to Fancybox 3 and using jQuery to sort pretty much everything out.

Read More →

Sorting out capabilities for custom post types is tricky. At least I think it is – mainly because it’s hard to figure out what you’re supposed to be doing. Both the code and the documentation seem somewhat opaque to me.

So this is my attempt at unraveling how it works – together with some different ways you might want to set up your custom post types. And it is an attempt, so if I’ve got something wrong or I’m not making sense, please let me know…

Read More →

I find admin notices are a pain. Every time I write a plugin there comes a point where I think “I’ll just add in some notices to help the user” – and two hours later…

I kept thinking, “This should be so much easier”, so finally I sat down and wrote a class that I can use in any plugin to handle pretty much every admin notice scenario I could think of. It’s available on Github for download with how-to explanatory info and examples.

Read More →

This post is one of the examples of how the Hooked Editable Content plugin can be used.

I’ve created this post as a user with the Author role, and in doing that I’ve also been able to add the gallery of two racing car images you can see beneath the main menu.

To do that, I used the hooked editor which was available to me on the Edit Post screen, below the main post content editor. As you can see, it’s just a normal WP Editor, but with the title Hooked Editor: Images after Main menu and some instructions. Using that editor, I could add a gallery of images in the normal way – just as if I was adding a gallery in the content of a normal post.

Read More →