One of WordPress’ most powerful features is its simplicity. Mainly due to the text-editor-like post editing dashboard, anyone familiar with MS Word or Pages can jump right in and start publishing on the web. While this simplicity is awesome, some super powerful WordPress features get hidden away behind the scenes.
Today, I wanted to dig up a few of these hidden gems. These features are not immediately obvious and can improve all sorts of WordPress workflows. Some of these tips will be more helpful for developers while others will be better for bloggers, but any WordPress user should find something useful here for their work.
1. Turn Off Upload Folder Organization
If you have ever delved into the WordPress uploads folder, you might be familiar with the yearly/monthly folder organization structure. For performance reasons, this organization structure is important on sites with lots of images. But, what if you’re making a simple five pager and you don’t want the deeply nested organization? Not to worry, it can be turned off from the WordPress admin panel.
2. Empty the Trash Automatically
Removing a lot of posts from WordPress can be a real pain. First, you must navigate through the paginated All Posts dashboard, then move the posts to the trash, then empty the trash. With this simple line in one’s wp-config file, the WordPress trash will automatically clear its self after X number of days:
define( 'EMPTY_TRASH_DAYS', 1 );
3. The Template Hierarchy & Custom Maintenance Pages
If you’ve worked with theme files before, you may have encountered the WordPress Template Hierarchy. The template hierarchy establishes which template file is loaded depending on what’s available within the theme. For example, custom page templates work because of the WordPress Template Hierarchy. If a custom page template exists, it will be loaded. Otherwise, the default page template will be loaded. If you've never seen the Visual Overview graphic, it's worth checking out.
When WordPress goes into maintenance mode, it will check for a maintenance.php file within your theme. If one exists, it will be loaded! You can customize your maintenance.php file just like any other template file.
4. Full-Screen Editing Mode
Admittedly, I am much more of a WordPress user/evangelist than a blogger. While I do write and blog a lot, it’s never been my sole focus. This would probably explain why I had never used WordPress’ full-screen post editing mode; until now. If the idea of removing distractions and losing oneself in the writing process sounds enjoyable, definitely give WordPress’ full-screen editing tool a try.
5. Enable/Use Keyboard Shortcuts
WordPress has keyboard shortcuts for both for the text editor and comment moderation! Anyone who spends any time in either of these areas of the dashboard will surely benefit from taking a look through the documentation. Using keyboard shortcuts, particularly for comment moderation, can save loads of time!
6. WordPress’ Default Image Quality is 82%
Yes, it’s true! WordPress’ default compression setting for images is 90%. What this means is, only when WordPress resizes an image for you, the JPEG quality is set to 90%. Depending on the situation, 90% might be perfect. But, perhaps you’re working on a portfolio site and your client wants to feature their work in it’s finest glory! Or on contrary, maybe you’re working on an image heavy magazine site that’s having trouble with page load speeds. There are many situations where 90% quality is too high!
To change this setting, you can add the following line to your theme’s functions.php file.
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) );
Or, this plugin will add a slider to the media settings page.
7. Change Users without Logging Out
This code snippet will allow you to change which user you are logged in as. This tip is particularly useful on multisite installations when one needs to swap from one admin account to another.
$user_id = 4; wp_set_auth_cookie( $user_id );
Pretty cool, eh?
8. Don’t Break on Domain Switch
I haven’t had a chance to test this trick yet, but if it works like it is supposed to, it will certainly earn a permanent spot in my WordPress tool belt. Moving a WordPress website to a new domain is a bit of a pain. WP-CLI has made this process a bit easier. But let’s be honest, it's still a hassle! With the line of code below in your wp-config file, WordPress will attempt to load on a new domain regardless of what’s in the settings. This means you can log in and change the site address and URL right from the WordPress dashboard. Depending on the site content, you may still need to do a serialized search and replace for hard coded URLs and things like that. But this code snippet should, at least, keep your site from breaking while you figure out those details.
oEmbed was one of those terms I was familiar with — in the sense that I have heard it many times before — but didn’t know what it was. To paraphrase the codex: in a nutshell, all you need to do to embed something into a post or page is to post the URL to it into your content area. That means, instead of digging through a youtube page for the embed code, just copy/paste the URL. It doesn’t just work for YouTube videos, there are tons of services available including Twitter, Imgur, Instagram, Scribd, Vimeo, and many others!
Update: As of 4.4 you can also embed other WordPress posts within a post!
10. There is a Boilerplate Generator For Just About Anything
Do you generate unique salts for your all of your WordPress installs? I didn’t think so, me neither until now!
There are countless generators out there that will automate many of the more cumbersome WordPress coding tasks. There is a salt generator and a whole website dedicated to generators for boilerplate WordPress tasks like creating custom post types, menus, theme feature support, and much much more!
As a long-time WordPress user, I was genuinely surprised at how many hidden features/tricks were out there. Surely this list only scratches the surface. What tricks have you discovered about WordPress. Any favorites?