Introducing Post Customizer

December 17, 2013 by Taylor Lovett

10up just released a new plugin called the Post Customizer. I, along with John James Jacoby, John Bloch, Drew Jaynes, and Carl Danley led the charge on the plugin. The idea of the plugin is to mimic the theme customizer for posts. The plugin adds functionality that displays an overlay when you click “Preview” within the post editor. The overlay has a sidebar allowing you to edit the excerpt and featured post. In the middle of the overlay is a frame that shows the front of the website. Within that frame you can edit the post title and content. This enables you to make “live” changes and to see how they look as you make them. There are other plugins that offer similar behavior. However, Post Customizer closely follows the Theme Customizer and thus WordPress standards.

We want to make this plugin super extensible, and we need all the help we can get. We would appreciate contributions! Fork the plugin on Github.

Why Are Taxonomy Lookups Faster than Post Meta Lookups?

May 14, 2013 by Taylor Lovett

So I’ve read all over the place that looking for posts based on a taxonomy is much quicker than looking up posts based on post meta. But why? I’ve yet to read any sort of technical explanation that satisfies my curiosity. I decided to do some research.

I wrote some example code and used the debug plugin to examine the resulting SQL queries. Here is a post meta query:

$args = array(
  'meta_query' =>
        'key' => 'test_key',
        'value' => '1'
$query = new WP_Query( $args2 );

Here is the resulting SQL:

FROM trunk_posts INNER JOIN trunk_postmeta ON (trunk_posts.ID = trunk_postmeta.post_id)
trunk_posts.post_type = 'post' AND
(trunk_posts.post_status = 'publish' OR trunk_posts.post_status = 'private') AND
( (trunk_postmeta.meta_key = 'test_key' AND
CAST(trunk_postmeta.meta_value AS CHAR) = '1') )
GROUP BY trunk_posts.ID
ORDER BY trunk_posts.post_date DESC
LIMIT 0, 10

As you can see the posts table is being joined with the post meta table. A join very basically creates a temporary table where every row in the posts table is matched with every row in the post meta table. The ON clause then narrows down that temporary table keeping only rows of posts that have been matched with post meta that apply to that post. Here is a database model of the post and post meta tables:


This joining of posts with corresponding post meta rows is done by comparing values across two indexed columns (trunk_posts.ID and trunk_postmeta.post_id) as shown in the diagram. Creating an index on a column in MySQL makes lookups on the column much quicker. Simply put, MySQL stores a B-Tree of the values in that column. A B-Tree is a data structure that allows search in O(log n) time (vs. O(n) time on an unindexed column). The disadvantage in indexing a column with a B-Tree type data structure is that inserting and deleting becomes much slower because parts of the tree must be rebuilt; this is generally a worthwhile sacrifice.

Next, the WHERE statement narrows down posts by meta key only keeping rows that have meta_key=’test_key’. Again, as shown in the diagram, trunk_postmeta.meta_key is an indexed column. So again we can do this in O(log n) time. Awesome, so where is the slow down? Well, the last thing we have to do is narrow the posts so we only have ones where meta_value=’1′. There is no index on the meta_value column. We have refined our posts as follows:

  1. posts matching with every post meta row
  2. posts matching with only post meta that applies to that post
  3. posts matching with post meta for that post with key ‘test_key’
  4. posts matching with post meta for that post with key ‘test_key’ and value ’1′.

On the final refinement, if there are multiple post meta rows with the same key associated, then we will have to search through multiple values until we find a matching value. This search will happen in O(n) which is slow.

Now let’s look at how a taxonomy query works. Here is my taxonomy query code:

$args = array(
  'tax_query' => array(
      'taxonomy' => 'category',
      'field' => 'id',
      'terms' => array( 2 ),
$query = new WP_Query( $args );

Here is the resulting SQL:

FROM trunk_posts INNER JOIN trunk_term_relationships ON (trunk_posts.ID = trunk_term_relationships.object_id)
( trunk_term_relationships.term_taxonomy_id IN (2) ) AND
trunk_posts.post_type = 'post' AND
(trunk_posts.post_status = 'publish' OR trunk_posts.post_status = 'private')
GROUP BY trunk_posts.ID
ORDER BY trunk_posts.post_date DESC LIMIT 0, 10

As you can see the trunk_posts table is joined with the trunk_term_relationships table. The two tables are joined into a temporary table which is refined by the ON portion of the join statement matching each term row with it’s corresponding posts.


As shown in the diagram there is an index on trunk_posts.ID and trunk_term_relationships.object_id, so this first refinement can be done in O(log n) time. Next the WHERE clause refines the temporary table so that only posts matched with the term id 2 are left. There is an index on the term_taxonomy_id column so this can be done in O(log n) time. Obviously, there is more to the query then just this but we don’t care about anything else for now.


Post meta queries will experience a major slowdown if the key(s) being searched are associated with a large amount of posts. Another big reason to avoid post meta queries is because the post meta table is typically much larger than the taxonomy_term_relationships table. Therefore doing a join with posts and postmeta is a much more expensive operation than joining posts and taxonomy_term_relationships. This analysis doesn’t take into account caching and is drastically simplified. If you have any questions or corrections, please leave a comment.

Safe Redirect Manager

January 8, 2013 by Taylor Lovett

Hey Everyone!

I wanted to let everyone know about a new WordPress plugin called Safe Redirect Manager. I am one of the main developers of this plugin, and it has just been released on WordPress.org along with WordPress.com VIP (which is quite a special honor).

So what is the difference between this plugin and all the other redirect management plugins? Well, this plugin is simple, safe, and straight to the point. Instead of using the WordPress options table to store redirects, it uses a custom post type; this is much more flexible and lighter on your server. The plugin has been tested and reviewed by multiple WordPress core contributors and is available on WordPress.com — in order for a plugin to be available on WordPress.com it must be extremely secure. Safe Redirect Manager also allows you to use regular expressions in your redirects (if you don’t know what this is, don’t worry it’s an optional feature).

Here is a screenshot:

Download here: http://wordpress.org/extend/plugins/safe-redirect-manager

P.S: If you are a developer, Safe Redirect Manager is available to be forked on Github.

Edit: Thank you Branco Radenovich for the Slovak translation. This will be included in version 1.6.1 of the plugin.

WordPress Reference Guide for Developers

November 30, 2010 by Taylor Lovett

WordPress theme and plugin developers, I found something you might like. A women named Natalie from DBS Interactive emailed me informing me of there WordPress Reference Guide for Developers. I am a huge fan of the WordPress Codex but the reference guide they put together is much easier to use than the WP Codex. It’s like an encyclopedia for WordPress theme developers. This is definitely worth a bookmark:

WordPress Reference Guide for Developers

Custom Contact Forms 4.0.0

October 26, 2010 by Taylor Lovett

Custom Contact Forms 4.0.0, the most intuitive and customizable contact form plugin for WordPress, is about to be released. Here is a short list of some of the new features being added:

  • Import/Export/Create Backups at the click of a button
  • New style options for your forms
  • Ability to add a different CSS class to each field
  • * All form submissions saved to database and displayed in administration panel in a visually appealing way. You can enable/disable the emailing of form submissions now.
  • * AJAX in the admin panel – now you can save, delete, and manage everything in the admin panel without refreshing the page. This will save you time.

Right now you can download the latest 4.0.0 beta version on the WordPress CCF Download page. Right now the only thing that is left to do is debug the new AJAX features. We need debuggers. Right now we are adding anyone who helps us with debugging to the WordPress page as a contributor with a link to the website of their choice. Email admin@taylorlovett.com if you’re interested.

Web Hosting from Hostgator: 24/7 Customer Support and 99.8% Uptime

October 5, 2010 by Taylor Lovett

I’ve been a professional web developer for around 8 years and this is an honest review of a hosting company that a believe deserves some recognition. Hostgator is hands down the best web host on the Internet today for a variety of reasons.

I’ve used a number of hosts: Godaddy, Network Solutions, Bluehost, Midphase, Globat, Hostgator and a few others. All these companies offer the world to customers at low prices. All most all of them do not deliver what they promise. I have horror stories from all these hosts expect Hostgator. Most of these hosts offer the same things Cpanel, PHP/MySQL, unlimited emails/subdomains, gigabytes of space, tons of bandwidth, etc. The two most important things you must consider when picking a web host besides having all the features your site needs is customer support and uptime.

All the bandwidth a space in the world doens’t mean anything if your website is down an hour each day. All these companies promise great uptime and customer support, the only one that actual delivers is Hostgator. I am telling you this from personal experience. The links to Hostgator in this post are affiliate links, but the content if this post contains no hype what-so-ever.

It is common knowledge web developers work late at night, we need to be able to contact our host late at night. Hostgator offers 24/7 customer support via phone, live chat, and email. I have tested the phone and live chat options at 4 AM on a Saturday night. Someone picks up the phone or enters the chat immediatly. Also the wait time at peek hours is very short, the longest I’ve EVER waited to speak/chat with someone is 5 minutes. No hype.

The reason I had to leave all the hosts above was because my website was down or loading too slowly far too often. Hostgator is the champ at uptime. My website is very rarely down and always is running quickly. Again, all the hosts above promise this but only one delivers.

There is no reason not to host your website with Hostgator. If for some reason you aren’t satisfied, they have a 30 day full money-back gaurantee.

Custom Contact Forms 3.0.0 and 3.1.0

August 31, 2010 by Taylor Lovett

Custom Contact Forms 3.0.0 was released and shortly after so was 3.1.0. CCF has grown to be quite the plugin, packed with awesome features, many of which you will not find in any contact form plugin.

An interesting new feature is Custom Html Forms. This feature allows people who are skill with Html and Css to use CCF simply to process forms. Now you can write the Html for your forms using the code provided by this feature as a framework. This feature makes this plugin ideal for web developers.

CCF 3.1.0 also finally has a reusable widget. Create forms in the CCF admin page, then on the widgets page chose which form you want to display. As with all forms you can use the default style or create a custom style and attach it accordingly. The possibilities with this plugin are endless and, best of all, it is very easy to use and navigate.

A few other new features to mention:
Ability to not use Jquery – great if you want to keep your page load time down
Ability to use a custom thank you message and thank you message title individually for each form.
Ability to change the background color of text areas
Ability to include forms in your theme files via php code
Much more!

CCF 3.5.0 will boast the ability to add drop down and radio fields. A new manager will be added to the plugin, the Field Options Manager which allows you to create options for drop downs and radio fields.

Get excited!

SEO Techniques for Bing

July 16, 2010 by Taylor Lovett

In the field of SEO, Google’s search engine dominates the market. But what about other search engines? Yahoo and Bing, despite not being as popular as Google, can still send your website massive amounts of traffic. Many of the on page and off page search engine optimization techniques are the same for all search engines, but some search engines place more weight than others in certain areas. Bing, Microsofts replacement for MSN, heavily favors sites that have proper validating HTML code. Off-page, Bing favors sites that utilize social networking and social bookmarking sites. Bing also likes sites that link to lots of relevant external sites.

Heres in interesting article on SEO techniques for Bing:
On-page and Off-page Bing SEO Techniques

5 Essential Free Tools No Web Developer Should Be Without

July 6, 2010 by Taylor Lovett

I’ve been a programming in PHP and developing websites for 8 years and here are 5 free tools that no web developer should ever be without. Most if not all of these require that you use Mozilla Firefox.

1. Web Developer add-on for Mozilla Firefox

Of course number one assumes you are already using Mozilla Firefox browser. This addon creates a toolbar in your browser that allows you to accomplish a myriad of things much more easily than if you didn’t have the toolbar. Disable javascript, highlight css elements, edit CSS elements and view your changes live, view code source more easily, outline block level elements, find bad code, view image properties, validate your code, auto-fill in forms (this is incredibly useful when testing a form with many fields), manage your cookies, and much, much more. It goes without saying that this toolbar is a necessity for any web developer, PHP/Javascript programmer, or WordPress plugin developer.

2. IE Tab Plus add-on for Mozilla Firefox

This add-on allows you, the user, to switch the Firefox rendering engine to that of Internet Explorer’s. Simply right click on a page and click view in IE; this opens a new viewing tab in your browser that renders your current web page in IE’s engine. When building web pages, web developers often switch between Firefox and Internet Explorer (the two most popular browsers) to see how their website looks in each. Now with IE Tab, developers can stay in their current browser

3. Ubiquity for Mozilla Firefox

Another Firefox add-on big surprise huh?!? Ubiquity allows for dynamic commands to be entered by the user. Ubiquity allows for extended browser funcionality with dynamic commands. After installing Ubiquity, users can subscribe to commands that Ubiquity developers have created. Pressing CTRL+Space brings up a console that accepts commands which otherwise would take a few extra steps to do manually. To list a few commands: lookup artilces in wikipedia, search, translate current page, and much more.

4. Ubiquity: PHP Function Lookup

PHP function look up adds a PHP function lookup command to Ubiquity. PHP developers often need to look up functions for a variety of reasons. Not anyone can remember the order of parameters and return type for thousands of functions. Opening a new tab, going to PHP.net, and typing in a function takes time. Ubiquity’s PHP function look up command lets you do this by simply pressing CTRL+Space then typing “php your_function”. This will save any PHP programmer tons of time.

5. Ubiquity: WordPress Codex Lookup

WordPress Codex Lookup adds a command look up feature to Ubiquity allowing you to quickly search the WordPress codex for information. If you use WordPress, create WordPress plugins, or modify WordPress themes, this will save you some time. Press CTRL+Space, then type “wp codex_search” and Ubiquity will open a new tab in your browser with your WP codex search.

Strange Google XML Sitemaps Error Fixed

June 24, 2010 by Taylor Lovett

Today, I installed the Google XML Sitemaps plugin. I configured the plugin accordingly then directed my browser to http://taylorlovett.com/sitemap.xml to see my newly built sitemap. I was confronted with the very ugly error:

Error loading stylesheet: An unknown error has occurred (805303f4)


After some searching on Google, I found others having the same issue but no definite solution. It seemed that directing my browser to http://www.taylorlovett.com/sitemap.xml worked fine but http://taylorlovett.com/sitemap.xml did not. I figured out the problem was that in my General Settings page my WordPress address (URL) was set to http://www.taylorlovett.com/sitemap.xml and my Site address (URL) was set to http://taylorlovett.com/sitemap.xml. After changing them both to the exact same URL, the problem was solved!