Purging All The Caches!

One of the best ways to ensure that a WordPress site–well any site really–stays performant and not broken is by leveraging caching. WordPress by default doesn’t do much caching other than some in-memory caching of objects, and the odd database caching via the Transients API. This site currently has three layers of caching: PHP OPcache […]

Quick Tip: Viewing Headers With Curl

Something that I do often at work is to check HTTP headers for random things such as redirects, cache headers, proxies, ssl, etc. A common way this is done is by using the -I (–header) switch: $ curl -I http://example.com/ HTTP/1.1 200 OK Content-Encoding: gzip Accept-Ranges: bytes Cache-Control: max-age=604800 Content-Type: text/html Date: Wed, 27 Jun 2018 […]

Disabling WordPress Faux Cron

The WordPress WP-Cron system is a decently okay faux cron system, but it has its problems, such as running on frontend requests and not running if no requests are coming through. WP-Cron works by: on every page load, a list of scheduled tasks is checked to see what needs to be run. Any tasks scheduled […]

Quick Tip: Force Enable Auto-Updates in WordPress

I know that auto-updates are a bit of a (#wpdrama) touchy subject, but I believe in them. In an mu-plugin I enable all auto-updates like so: <?php // Turn on auto-updates for everything if ( ! defined( ‘IS_PRESSABLE’ ) || ! IS_PRESSABLE ) { add_filter( ‘allow_major_auto_core_updates’, ‘__return_true’ ); add_filter( ‘allow_minor_auto_core_updates’, ‘__return_true’ ); } add_filter( ‘auto_update_core’, ‘__return_true’ […]

Query Caching (and a little extra)

By default, WordPress does not cache WP_Query queries.  Doing so can greatly improve performance.  The way I do this is via the Advanced Post Cache plugin: https://github.com/Automattic/advanced-post-cache By running this plugin (hopefully as an mu-plugin) with a persistent object cache, WP_Query calls, along with get_post() calls (only if suppress_filters is false) will be cached. Bonus! Now that we’re caching queries, […]

Auto-enable WP_DEBUG with a cookie

One of the most important things to do when working on new themes, plugins, or debugging issues in WordPress is to turn on WP_DEBUG.  According to the Codex: WP_DEBUG is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout WordPress. It is assumed to be false by […]

Windows, SFTP, and the Registry

One of the tasks that I have to do often at work is copying data to and from an SFTP directory.  Previously I had a constant domain and port that I was able to connect to, an I could save this in a WinSCP profile for ease of use.  Due to some recent architectural changes though, […]

Gutenberg, Code, and Highlighting

One of the great things about Gutenberg is the ability to compartmentalize different types of content within blocks.  One of the blocks that I’ve been using a lot of recently is the code block.  This block by default will render something like this: While this is acceptable, it’s not very pretty.  I used to use […]

Securing WordPress Plugins with more Plugins

I’ve written before about disabling plugin deactivation in WordPress, but I’ve finally used that knowledge in practice–on this site. The Problem Let’s say you’re going along your day, developing things, and fixing things, and making the world a better place when all of a sudden you get a call from a client that their website […]

CSS & JS Concatenation in WordPress

At WordPress.com VIP one of the features we have on our platform is automated concatenation of Javascript and CSS files when registered through the core WordPress wp_enqueue__*() functions. We do this using the nginx-http-concat plugin: https://github.com/Automattic/nginx-http-concat This plugin was written to work with nginx, but the server running derrick.blog is Apache.  I’ve worked around this and have nginx-http-concat running fully […]

%d bloggers like this: