Transients are a simple and standardized way of temporarily storing cached data in the database by giving it a custom name and a timeframe after which it will expire and be deleted. But sometimes, transients set by WP and countless plugins can take a lot of space in your database. Using a simple SQL query, you can easily getting rid of them.
Hacks & Code Snippets
When you’re blogging, it can be a good idea to display a warning to your visitors stating that they are currently reading an old post which might not be up to date. Here’s an out-of-the-box solution to do it.
If you’re often writing the same kind of post (articles, lists, code snippets, etc) you may find very useful to pre-populate the WordPress editor with some custom content. Here’s a super easy code snippet to do it.
If your site offers the possibility for users to register, you might at some point want to be able to display users’ registration date. Here’s a super simple code snippet to create a WordPress shortcode that will display registration date of a specific user.
When adding a meta box to a page in WordPress, you might want to disable the default editor. Simply drop this snippet in your theme’s functions.php file to disable the editor for a specific page template.
For maintenance or any other purposes, you might want to be able to know what plugins are currently active on a specific WordPress install. Here’s a handy snippet to get a list of active plugins in a matter of seconds.
Have you ever wanted to change the default role names (Administrator, Editor, Author, Contributor, Subscriber) within WordPress? Here is a super useful snippet to do so.
Don’t like the “shake” effect which occurs each time a login error occurs? Here is a super easy snippet to remove it for good.
Even if you’re careful when approving new comments, sometimes you might just forget to visit the commenter url and detect a long time after that the linked site is spammy. Here is a very easy way to bulk delete all comments with a specific url, using a simple SQL query.