Currently reading: The Shining by Stephen King

Debug PHP variables discreetly

If you don't have Xdebug involved in your current project, you may be relying on var_dump or var_export to check on things while coding. Depending on where in the code this happens, their output can get in the way of the rendering of a given page or be hard to read given where it lands ⸺ in one part of a three-column block, for instance.

Keep on readin' on Debug PHP variables discreetly

Nested pages cannot be found with WP_Query

It's hard to believe, I know, but despite its massive list of available parameters, WP_Query somehow doesn't seem to have the tools available to look for grandchildren (and beyond) when querying hierarchical post types. Due to it only supporting the post_parent field, you end up having to nest queries, use custom SQL, or use post__in with a secondary call of some sort to fill the "in" set of posts through which WP_Query will look.

Keep on readin' on Nested pages cannot be found with WP_Query

Get the WordPress document title with less work (maybe)

Reusable hero or banner partials often require more robust title-sniffing operations given to their placement inside or outside of The Loop™. In these, a simple the_title() call sometimes won't suffice, so you'll have to figure out what kind of view you're looking at and adjust the title accordingly.

Keep on readin' on Get the WordPress document title with less work (maybe)

Move your WordPress theme's templates into a subdirectory

Building on our (mostly unnecessary) add_filters() function to attach a callback to multiple hooks at once, we can adjust how WP's template hierarchy works. Yes, page-specific templates could already go in a `page-templates` directory, but this hook lets all of your templates go into a directory of your choosing.

Keep on readin' on Move your WordPress theme's templates into a subdirectory