Bradycardia & Cardiac Arrest for WordPress 3.6

Bradycardia is the resting heart rate of under 60 beats per minute….

WordPress HeartbeatA new feature in WordPress 3.6 is an upgrade to the autosave functionality that’s been around for years. It’s called “Heartbeat” and it makes sure you have valid authentication credentials, aren’t working on the same post as other people, and more. The problem is that (as it is) it slows web pages down to a grinding halt.

Read the active discussion on about this feature – a lot of people are upset about the CPU load it adds.

Note: I don’t recommend doing these changes on every Admin page. Use sparingly.

Slow Down WordPress 3.6’s Racing Heartbeat

Here’s how to slow down the heartbeat from once every 15 seconds (the default) to once every minute (the max allowed by WordPress): Continue reading “Bradycardia & Cardiac Arrest for WordPress 3.6”

Merge Settings Into an Array in WordPress

Arrays Merging

I found people are coming to this site (to an unrelated article) looking for a way to merge settings into an array.

You’re looking for `wp_parse_args()`

The main function for WordPress to do this is `wp_parse_args()`. You likely want this function.

Learn more about `wp_parse_args()`

Also consider `shortcode_atts()`

This is used for parsing shortcode options. It only supports defined arguments.

Learn more about `shortcode_atts()`

Simple Way to Get Plugin Status in WordPress

Active plugin volcano.

I have previously written on how to determine if a widget is active. This is helpful for widgets, but not for plugins.

WordPress has a couple of different functions that help you determine plugin status. They are both located in wp-includes/plugin.php

  • `validate_plugin()` spits out an error if the plugin file does not  exist or has an invalid header. This lets you know that the file is there.
  • `is_plugin_inactive()` lets you know if the plugin is not active (using the `is_plugin_active()` function)

A function to get plugin status

Using these two functions, I put together a one-size-fits-all function `get_plugin_status()`. Continue reading “Simple Way to Get Plugin Status in WordPress”

Auto-Optimize WordPress Database without a Plugin

These horses are somehow not cool. Speeding up your blog is.

I am working on a WordPress project that has a pretty heavy database, and I want to be able to auto-optimize the WordPress database. Even though they are integrating this functionality into WordPress 3.0, I want it now, and without having to use a plugin (I have had some issues with WP-DBManager configuring properly on a few sites).

If you add the following code to your functions.php file, it will automatically optimize your WordPress database every 6 hours, keeping it squeaky clean. Continue reading “Auto-Optimize WordPress Database without a Plugin”

Add Custom Titles for Tags and Categories in WordPress

The Best WordPress SEO Plugin? A combination of two.

All in One SEO Pack (AIOSEO) is the leader in WordPress SEO plugins. It offers great functionality and simple integration into the process of writing a post. AIOSEO is not a perfect plugin, however, because it lacks some very important functionality:

  • Custom category title tags
  • Custom tag title tags
  • Mass editing of page, post, tag and category title tags/slugs

The plugin that has all of the features above (but lacks AIOSEO features) is SEO Title Tag, an imperfect but elegant solution to the list above.  This article shows how to use both plugins and have them combine forces to create a powerful solution for getting custom titles on all your site’s pages. Continue reading “Add Custom Titles for Tags and Categories in WordPress”

Save Coding Time by Creating Special-Case Categories in WordPress

When you would use excluded categories:

When using WordPress as more of a content management system (CMS) than a blogging platform, there are many things that you need control over. One of them is special-case categories.

  • Frequently asked questions
  • Testimonials
  • Case studies
  • Press releases

When you have a category of posts that you don’t want to have comments, publishing dates, post author, etc., you can define a list of excluded categories. In most cases, you should use Category Templates to achieve this functionality, but that is not always practical or the best option. Continue reading “Save Coding Time by Creating Special-Case Categories in WordPress”

Get Adjacent Images – More WordPress Functions

Get the adjacent photo, man.

WordPress, just get the adjacent image links. I’ll tell you what to do with them!

WordPress is normally great about providing functions that have a return and an echo version.  In WordPress, if a function has the prefix get_, then it does not echo (print it into the content), but rather returns the result so that it can be saved as a variable, like so:  $example = get_example();

There are some functions that only have echo capability, so I wanted to share my work-around with you all.

Updated image_link functions

  • adjacent_image_link() » get_adjacent_image_link()
  • previous_image_link() » get_previous_image_link()
  • next_image_link() » get_next_image_link()

Continue reading “Get Adjacent Images – More WordPress Functions”