I'm using the old "2021" theme as a parent theme for this site. Why? Because it's the last of the default themes not based in Gutenberg blocks. So-called "classic" themes are the best themes. Fight me. Anyway, this theme has enormous post titles out of the box for whatever reason ⸺ the trend of the… Continue reading WordPress rewrites your editor styles… sometimes
Tag: hooks
Get a list of all WordPress hooks that have run
In order to truly catch them all, we can use a "must-use" plugin. These live in the /wp-content/mu-plugins folder as flat PHP files that are automatically included, in alphabetical order, before much has happened in the WordPress core loading process. Normal plugins load fairly early, but these are pulled in even earlier. Their inclusion can't… Continue reading Get a list of all WordPress hooks that have run
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. If you don't want to do all… Continue reading 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. A bit fussy, yes, but there… Continue reading Move your WordPress theme's templates into a subdirectory
Attach a callback to multiple hooks at once
I originally had this stuff as a "bonus tip" in the other post about getting drafts and private pages into the parent-choosing drop-downs, but it ended up longer than the main content! If you don't like having random named functions hanging around, like __dropdown_pages_args() in the post above, you can instead wrap add_filter() with your… Continue reading Attach a callback to multiple hooks at once
Add private and drafted pages to parent drop-down lists
I'm sure that in most cases the default behavior of only showing published pages is probably what you want. Who needs a bunch of outdated or unfinished pages cluttering these lists, right? But what about the case where you're trying to create a bunch of pages all at once, a series of related and therefore… Continue reading Add private and drafted pages to parent drop-down lists
List and edit your registered Gutenberg blocks
Depending on your situation, you may need a two-pronged approach to clean up the overly extensive list of blocks available in the Gutenberg inserter by default. Why would you want to do this? Well, for one thing you may not be using a "block theme" and thus have no use for any or most of… Continue reading List and edit your registered Gutenberg blocks
Move drafts to the top of your WordPress posts list
This isn't something WP supports by default as it has a strict list of available options for its orderby parameter and post_status ain't one of 'em. Well, let's fix that. Yes, your posts drafts will probably be near the top anyway with the default descending date sorting, but sometimes things fall behind. Your page drafts,… Continue reading Move drafts to the top of your WordPress posts list
Disable Elementor AI Upsells in 2025
Elementor does offer a way to disable its AI upsells but only on a per-user basis. Talk about annoying, eh? Also, I needed a first post so this thing would stop serving up a 404 as an introduction, and I suppose this is as good as any. There are a lot of outdated answers on… Continue reading Disable Elementor AI Upsells in 2025