A backdoor that has been dubbed “CryptoPHP” was found hidden in pirated (“nulled”) themes and plugins for WordPress, Drupal and Joomla.
This code creates a shortcode, [gists], which displays a list of all Gists by a user, grouped into categories then listed alphabetically.
Run this to replace URLs in the database when moving a WordPress blog from one URL to another.
This is a script I use on a lot of sites to copy the database (MySQL) and any uploaded files to the development site, and modify the database as required.
I use this to split my theme’s functions.php into multiple smaller files on particularly complex sites, and to autoload those files (instead of having to manually require each one).
This is a filter to take Gravity Forms format dates (dd/mm/yyyy) and convert them to WP-Types format dates (integer).
In this example the event start & end dates are entered as timestamps using WP-Types. It could also be modified for Advanced Custom Fields which uses strings.
This allows you to indent lists/paragraphs in the TinyMCE WYSIWYG editor using Tab, and outdent using Shift+Tab. I wrote it because I write a lot of nested lists, it’s tedious using the keyboard to indent and outdent, and I couldn’t find any…
With wp_insert_post() and wp_set_post_terms()…
While entering several back-dated posts into a WordPress blog, I got annoyed at the date fields being in American month-day-year format and decided to fix it.
WordPress saves post password cookies for 10 days, and there is no setting or filter to change that, but you can use this code to replace the form action entirely.
This hides the permalink and edit button on the Edit Post page in WordPress. It is useful for when permalinks are not editable (e.g. if it uses the post ID only) in that case its really just taking up screen…
This hides the title textbox in the Edit Post page in WordPress. It is possibly useful when using a theme like P2 that doesn’t actually display the title, so you don’t want to be going to the trouble of writing one.
WordPress stores the site URL in the database by default (which I have never understood), and its a pain to have to type out the UPDATE SQL or search in phpMyAdmin to change it. This is a simple way to…
There are three options (that I know of) for automatically enabling a plugin in new sites.
When you create a new WordPress Multisite blog from the admin area, you have to enter three things: Site address (subdomain or folder name), Site title and Admin email…
I used this code snippet as part of a WordPress Multisite plugin, to allow me to quickly set some options for all blogs in the network.
This code was used to generate a menu showing all blogs on a WordPress Multisite installation.
The WordPress function the_category() doesnt work particularly well when you have hierarchical categories.
I used this code to automatically set the default post title, category and tags for a new WordPress post based on which link was clicked.
On one WordPress blog I have categories for “Starred” and “Archived”, in addition to the real categories. I hacked this together to make sure the posts would still go into Uncategorised as well.
This is a follow-up to Toggle “Starred” Category in WordPress – making it more generic and usable for multiple categories.
Even if you disable all but one theme, WordPress seems to default to TwentyTen when creating a new Multisite blog. The fix is simple though – add this to wp-config.php.
I did this simple hack on a private WordPress Multisite blog, to stop it sending me emails every time I created a new blog. It’s definitely overkill to stop all emails, but unfortunately I couldn’t find any hooks that let…
Filosofo Comments Preview is a WordPress plugin that lets you preview comments on your blog before you submit them. In the current version (1.5) it doesnt increment the number of posts, so it still says there are no comments when you…
This is a modification to the theme’s functions.php that adds a widget to list all of the posts in the “Starred” category.
This redirects to the post/page itself after publishing or updating a post in WordPress.
How to add a simple “star” flag to posts (a la Gmail).