Category: General

Clear W3 Total Cache by URL From the Admin Bar or Dashboard

When recently working on a WordPress website that generated pages from an API that aren’t stored in the main site database, I discovered that the W3 Total Cache admin bar link to clear the current page’s cache didn’t work.

The ‘Purge Current Page’ link in the Performance menu item works by passing the current post ID to a function that clears the cache by an ID. Since this only works for single posts, it also doesn’t work on post archives and term listing pages.

So I wrote a small plugin to clear the current page’s cache by its URL.

Continue reading “Clear W3 Total Cache by URL From the Admin Bar or Dashboard” ››

Automatically Add Unique CSS Classes to Contact Form 7 Forms

When using certain CRMs and marketing automation tools, Contact Form 7 submissions can all look like they came from the same form.

This is especially noticeable in HubSpot which uses the class on the form tag to identify each form. Unless you specifically add a class to the shortcode then it will look like any submission came from a form named “.wpcf7-form, .init”

So I wrote a small plugin to automatically add the title slug as a form class for any forms that haven’t had one added manually.

Continue reading “Automatically Add Unique CSS Classes to Contact Form 7 Forms” ››

Forcing W3 Total Cache to Clear Parent Term Listing Pages on Post Save

In the page caching settings of W3 Total Cache there is an option to flush the ‘Post Terms Pages’ when saving or updating a post. This clears the listing pages for any terms that the post has been added to, but it doesn’t clear the listing pages of any parent terms that aren’t checked, even though the post can still show on those pages.

The following code uses WordPress filters to detect a change in a post and then invalidate the cache of any parent term listing pages whether they have been checked or not.

Continue reading “Forcing W3 Total Cache to Clear Parent Term Listing Pages on Post Save” ››

Mapping a Synology NAS Drive in Windows 11

How to map a Synology NAS with Windows 11 that you previously had connected with Windows 10

Continue reading "Mapping a Synology NAS Drive in Windows 11" ››

Prevent PDF Caching With Invoice Ninja 5 (Apache, .htaccess)

If you find that PDF files aren’t updating after changes, it could be that they are cached by the browser or a CDN such as Cloudflare.

Continue reading “Prevent PDF Caching With Invoice Ninja 5 (Apache, .htaccess)” ››

Customising the Client Portal Colour In Invoiceninja 5

Customizing the invoiceninja V5 client portal colour scheme.

Continue reading "Customising the Client Portal Colour In Invoiceninja 5" ››

Loading Disqus Comments On Demand Without jQuery or AJAX

Posted in General

There are many posts around the internet about loading Disqus comments on demand, however, I found many of them either rely on jQuery, try and load the embed.js file via ajax and run into CORS issues or just lack small bits of functionality. So I thought I would put everything together in one gist.

Continue reading “Loading Disqus Comments On Demand Without jQuery or AJAX” ››

How to get your Windows 10 Key

Posted in General

I recently bought a new pc, and was a bit quick to install Windows, create a backup drive and remove the disk to install the larger ssd from my previous computer.

The upshot of that was that, after installing the operating system on the new drive, it wouldn’t activate Windows as I didn’t fully activate it on the first install before making the recovery drive.

In the end, I got in contact with a Windows support person who recovered the activation key from the computer hardware. Which is pretty simple when you know the commands.

To get your key:

Right click on the start menu and select “Command prompt (admin)”

Type in:

wmic path SoftwareLicensingService get OA3xOriginalProductKey

You should then get your key in the console output.

Issues Assigning Nameservers to .de Domain Names

I recently ran into an issue whilst trying to change the nameservers for a German (.de) domain name. When I tried to point the domain to a whm/cpanel install I got the error ‘Failed to Modify Domain Nameservers: The domain DNS check has failed’.

The reason for this is specific to .de domains.

Continue reading “Issues Assigning Nameservers to .de Domain Names” ››

Standard URLS Called by Websites for DNS Prefetching

There are many articles out there on how DNS prefetching works so I will keep it brief.

It works by adding a link to the head of your web page with a relationship of ‘dns-prefetch’ and the url of a domain which holds assets needed for the page to load. That could be a cdn for the site, a social plugin or anything else.

Without prefetching, a browser will render the page top to bottom and when it gets to an asset which needs to be loaded from another domain it performs a dns lookup to find the location of the host and then downloads the assets. By adding prefetching links we are letting the browser know that these domains will be used before the assets are requested. Browsers can then loook up the hosts whilst rendering the rest of the page, cutting out this step when the assets are needed leding to a shorter download time.

This process is non-blocking and will only be performed when possible. For example, on a small page requesting an asset from another site high in the head of the document, it’s likely that the asset will be loaded before there is a chance to prefetch the dns.

The point of this article is to list domains used by common services for easy future reference.

Continue reading “Standard URLS Called by Websites for DNS Prefetching” ››