WordPress Bible Release

Last night, I got home to find my copies of the WordPress Bible at my door. This was tremendously exciting as I have been waiting for 8 months for this day. It was exciting and the buzz on Twitter has been tremendous. Pre-sale numbers were huge. The sharing and re-sharing of information about this book has been deafening.

Below is a video of the unboxing. And of course, you can order the book today from Amazon and I hope you do. If not for the book, to support my efforts. Thanks to everyone who has stood by me during this process!

The Greater Good: Entrepreneurship, Open Source, and a Better World

Last night, I was catching up with a friend who is as far from me in lifestyle outlook as you could possibly be. She is a extremely left wing type working for an environmental advocacy organization in DC. I, on the other hand, am an entrepreneur with one foot planted firmly on the right and one foot firmly planted on the left.

The conversation came to an issue that I’ve only marginally thought in great detail about. I had made the comment about how I am potentially looking to leave the DC area because, as I put it, it’s not my scene. I feel like a square peg trying to be fit into a round hole. While I certainly have political views and will sometimes voice them, my life does not revolve around politics, policy and advocacy as it does in Washington. In fact, when pressed to explain my feelings around why I dislike DC, I described myself as a regular guy wanting to live a regular life in a regular town.

Defining that more explicitly, I appreciate town like Baltimore, where I was raised and lived most of my life, because it’s filled with people who go about their normal everyday lives. No one is trying to “save the world” as seems to be the case in DC. Certainly, there are people and companies (hopefully many) who take a balanced position in life to be good stewards of the earth, energy and the planet. Certainly, many are socially conscious in how they live their lives. But it isn’t an all consuming agenda such that you find in DC.

I love Austin too. Why? Well, it is the self described live music capital of the country. On any given night, from my experience, it is not difficult to find bars that have a good live music set that is original and that doesn’t carry a cover charge. Outside of a handful of live music venues (DC9, 9:30 Club, Velvet Lounge, Madames Organ to a degree, Rock and Roll Hotel, etc) it’s hard to find a burgeoning music scene in DC.

Even with sports, which consumes a fair bit of my life, it’s hard to find supporters of the home team. No one, it seems, is from DC. They all came here with an agenda. You have to go out to Maryland or Virginia to find real hometown fans.

This is not my scene. This is not what I like. I am an entrepreneur because, first and foremost, I want to make money. When I made a break from my former corporate job, it was after becoming aware of how much my employer was billing our customer for my services and realizing that if that was how much I was worth, I could damn well do that on my own.

But that’s the crux. As entrepreneurs, our general purpose is not to do social good (though there are exceptions). Not that there is anything wrong with that. There isn’t. But entrepreneurs get our kicks from building something. From doing something. And of course, from making money. Who starts a company with the intention to not increase profit margins? You show me that entrepreneur, and I’ll show you an entrepreneur who will fail within a year.

There, of course, is a balance. Like Geoff, Beth and Kami are doing at Zoetica, there’s a balance between making money and doing good. The more I had this conversation with my friend, the more shallow I realized I sounded.

But as I thought some more, the more I realized that doing good is not something you do. It’s something you are. Based on the integrity and character of the entrepreneur, the decisions that are made, whether geared for profit or for building a product or spinning it up into an acquisition by Google, become decisions made out of the character and integrity of being “good”.

Frankly, the more I thought about it, the more I realized that even what I do as an entrepreneur creating services and products around WordPress, (and yes, even sometimes writing patches for WordPress core itself) is done to make the world a better place. Even writing a book on WordPress and travelling to San Francisco, Dallas, New York, Atlanta, Miami, Chicago and Raleigh speaking to WordPress users, developers and designers is done to extend the platform, thus extending the reach and improving on the largest self-hosted blogging platform on the planet.

Think about why this is important. It’s not just about WordPress. It’s about enabling voices. Giving those who never had a chance to speak before the opportunity to be heard. We’ve heard as recently as this week about the man who used an iPhone app to figure out how to treat his own wounds while buried under the rubble in Haiti.

The Chinese government is so threatened by web technologies, and blogging in particular, that they have banned WordPress.com in China.That is not likely to be lifted anytime soon, especially as the government lockdown and censorship of the Chinese people is thrust back into the limelight with the latest Google-China fallout.

Even the internationalization efforts in WordPress is putting WordPress into the hands of more people in more countries and making it possible for voices to be heard, not only in the United States, but in the Sudan and Kurdistan as well.

As an entrepreneur with integrity and character, even the mundane decisions that go into building a company can be seen as social good. This is not intended to diminish the efforts of those who explicitly set out to do social good, but with the right mindset, the things that make us successful can also make the world around us better.

PHP Doesn't Do WordPress and WordPress Doesn't Do PHP

If there’s one thing I have been consistent on in the past (almost) 6 years of blogging and engaging on the web, it’s that I believe in the mantra “no sacred cows”. In politics, I confound and confuse members of both parties who look at life through sterilized lenses that reflect their party platform. I will often stir up controversy by dragging people into a process of debate that, while respectful, causes them to think and re-think their positions. At least that’s the goal. I am a fiercely independent thinker and though some of my closest friends are on the left, I’ve ruthlessly challenged the parts of the left that I don’t like while supporting the ones I do. I’ve done the same thing with folks on the right.

So as I prepare to write this article with an admittedly slightly inflammatory title, I expect it will cause some controversies – maybe, and perhaps intentionally, it will cause some rancor in the leadership of the WordPress community itself – the ones who set the tone and cadence for the rest of the community. This is not all bad and nobody can ever accuse me of not being consistent in how I approach issues I feel strongly about.

For nearly 10 years, I have been coding in PHP. For the past 4, I have spent my time focusing my energies on WordPress specifically. It seems to me that for software that is built on PHP, then, there should be some consistent crossover between the WordPress community and the PHP community. That natural convergence does not seem to exist however.

Early on, when getting started on the web, I hung out a lot over at the SitePoint Forums. It was there that, through a community of PHP developers of varying skill levels, that I cut my teeth. I knew nothing at the time and there were folks who were much more skilled than me. It was in the PHP 4 era (that era had just begun and has since ended) so there was no such thing as real classes and object orientation. XML parsing became a hot topic during those days as PHP devs wrestled with the best way (they were all ugly!) to parse XML. I was just trying hard to figure out how to connect to a database.

I spent months learning and picking up what I could and contributing back my learnt wisdom to other newbies along the way. The cycle of karma was great as people learned and taught each other.

Shortly after I left SitePoint in 2003, I started blogging (May of 2004). I started on Textpattern but within a week, as my curiosity about this new WordPress platform started hitting my ears, I switched over to WordPress. I joined the wp-hackers mailing list and began immersing myself in the WordPress community. Generally speaking, people were very helpful and I learned a lot.

Eventually, as part of that community, I would lead the technology efforts at b5media where my team was responsible for a very large WordPress farm. Having some of the best and the brightest working alongside me meant that my good understanding of the PHP involved in WordPress, and the event driven nature of its core, would increase to maybe very good.

Today, my business is WordPress. I just wrote the WordPress Bible. I do WordPress consulting. I run all my blogs on WordPress. I speak at WordCamps all over. Heck, I’m organizing WordCamp Mid-Atlantic again this year. I love the WordPress community.

During the writing of the Bible, Keith Casey, my friend and also a top developer in the PHP community (He works with Marco Tabini of PHP Architect – if that doesn’t give him street cred, I don’t know what will), offered to review anything I wrote along the way. I took him up on it even though I already had editors including a very WordPress-specific technical editor. My thinking? Having someone from the greater PHP community look at my code for the WordPress world can only make it better.

My question is, why doesn’t the rest of the WordPress world do this as well? We, as a community, can only be better by embracing the greater PHP community. We can learn things from them. They can learn things from us. Of course, the greater PHP community is going to scorn WordPress for remaining PHP 4 compatible when PHP 4 is end of life and I think that point has validity but that’s not the point. I think both sides can agree that WordPress has its way and it is not likely to change its philosophy on this soon.

However, what about the rest of the converging community? Why do WordPress people not participate in the major PHP conferences like Tek-X or ZendCon? Why was Beau Lebens the only WordPress guy that I’m aware of that attended any of the 7-conferences-in-14-days-roaming-conference CodeWorks?

Why is it that when WordPress developers are asked to speak at these events, they look down their nose in scorn (I can think of two specific incidents that have been related to me)?

Hey, if we’re going to have a war on PHP coding ability, I’ve got to side with the PHP coders of the world, not the WordPress coders. If we’re going to have a war on extensible platforms, well, I’ll probably go with WordPress.

My point is really simple: The WordPress community needs to abandon this concept of elitism and isolationism. Yes, isolationism only makes you isolated. Over the past six months, I have come to appreciate the greater PHP community more. I’ve rekindled my love for that community and the karma and learning that comes from it. I’ve discovered new things about PHP because I’ve opened my horizons again and got outside the WordPress box. Fortunately, by doing so, I can apply that knowledge and karma inside the WordPress world as well. It’s sort of like finally getting that water after being parched and thirsty for so long. It’s refreshing and gives new energy and drive.

So in 2010, I will continue to work inside the WordPress world to try to influence change. My code will reflect that change. I’ve abandoned PHP 4 (but again, that’s beside the point) and won’t work with it in my own work, plugins, etc. I hope to make a major announcement regarding some crossover and convergence in the next few weeks as well.

To the PHP World: Understand that the WordPress world is different. You already know this. We are a PHP 4 world for a reason, like it or not. We need some understanding. We also have our feelings on GPL and open source which don’t always jive. Work with us. Help us be better.

To the WordPress world: Get outside your comfort zone and embrace the leaders in the PHP world. I already mentioned Keith. Add Marco Tabini, Ben Ramsey and Cal Evans to the list of people to pay attention to.

WordPress and PHP 5: Be the Change You Want to See

The other day, I wrote the popular 10 Things You Need to Know About WordPress 2.9. As usual, most people are very excited about the new release which is now in beta and available for testing. In the article, I made a few fundamental errors which I have since corrected.

Notably, I mentioned that WordPress 3.0 would be going to PHP 5. This was based on conversations I had with a core developer which I now realized I misunderstood. Kinda. WordPress will probably not be dropping PHP 4 support in WordPress 3.0 but as core developer Mark Jaquith suggests:

Some things already require PHP 5, like time zone support or oEmbed. There are no plans that I know of to remove PHP 4 support in 3.0 “” last I checked we still had 12% of WP installs using PHP 4.

I see more of a natural and gradual deprecation of PHP 4. We’re very much open to making new features require PHP 5 if it would be a pain to make them PHP 4 compatible.

As a PHP developer, I am on board with calls for PHP 5 support. PHP 4 has been end of life (EOL) since August 8, 2008. That basically means that there will be no more releases, no more security patches, no more nothing. It’s done. Stick a fork in it. However, as Matt mentioned on stage at WordCamp NYC this weekend, there are still 12% of WordPress installations using PHP 4 hosting. He breaks that down as approximately 2M installs, the size of a major American city. More precisely, that’s approximately the size of Philadelphia.

This is not to defend WordPress development. I’d leave Philadelphia behind in a minute if I could get access to real object oriented PHP, reliable XML parsing, better HTTP transports and so much more. Yes, Philadelphia… I just threw you under the bus. That’s for signing Mike Vick. However, as Mark suggests, increasingly more features are being added to the core that require PHP 5.

oEmbed, which will ship in WordPress 2.9, requires XML or JSON parsing. XML parsing sucks in PHP 4. JSON ships by default in PHP 5.2. It is easier to backport JSON support to PHP 4 than try to engineer XML parsing for PHP 4. Some in the PHP community feel like backporting a PHP 5 feature to PHP 4 disincentivizes PHP 5 movement. It may, I’m not here to argue that.

Time Zone support is handled via the PHP class DateTimeZone, a PHP 5 class. Of course, on PHP 4 hosts, the user simply has to set the UTC offset (say, UTC-5 for Eastern Standard Time) manually. Graceful degradation.

I personally was one of the first people to write code for the SSH2 portion of the one click automatic upgrade feature. I, of course, did not go very far with it, but I was the one who first took a stab at creating that.

It is not worth it for PHP developers to throw mud at WordPress developers and the PHP 4 requirement if they are not willing to write code to make it better. Writing code does not, of course, mean that your feature will be incorporated. But this is an open source project. If you want to see new features, and the developers have indicated willingness through not only words, but also action, to include PHP 5 features, then you need to be the champion of those changes. In other words, you need to write the code, submit the ticket and state your case. Even if you can’t write the code, open a ticket and be a champion for the case.

Effective arguments, however, do not include holy wars over PHP 4 or PHP 5. Effective arguments do include security, usability, and feature requests that reflect “must have” features. Is it plugin territory or should it be a core feature? Why? State your case.

I will admit not being overly active in the ongoing development of WordPress. I have client work built around WordPress, so that takes up most of my time. Understanding that, I also have no room to throw mud unless I’m willing to step up and write code too. It’s sort of like voting. If I don’t bother to go vote, then I can’t complain about my elected officials.

If you want to see change in WordPress, be that change and put your words into action.

The WordPress Bible: A Writing Redux

Back in July, I noted that I had accepted and was beginning the process of writing The WordPress Bible for Wiley Publishing. You can read that post here.

It’s now November and almost everything is in the bag for me. I’ve written the book with an average of 20-30 pages per chapter. I’ve gone through Author Review (A.R.), more commonly called “editing”. I’ve taken screenshots. Wrote code. Sifted through pages and pages that have so many changes, from three different editors, that the page appears to bleed. I’ve survived. Sometimes barely. I want to talk about the process of writing that book.

Writing a book is as much mental as it is emotional. Everyday, you evaluate what you have to get done, how much time you have to get it done, and consider the tone and voice in which it is written. I noted in my announcement that I would take on extra work to compensate for the lack of full-time pay the advance money would turn out to be. This became the most difficult part of the process, as it would turn out.

Early on, I spent a tremendous amount of time being very precise and intentional in how I wrote. It was a very slow process but I was pacing myself. I had 4 deadlines at 25% increments that were a month apart (except the last one). I could afford to be deliberate and intentional and pace myself. I had nine chapters to write in 30 days. Done. The first deadline was no problem, but it was a definite time investment.

The second deadline approached in late August. It was the 50% deadline and nine more chapters were due. By this time, I was heavily invested in the two client projects – a corporate redevelopment of Navstar, a federal IT service provider in Northern Virginia and TheCityFix, a WordPress MU/BuddyPress-based project for EMBARQ, a major non-profit in DC. Both of these projects were lagging behind as I went about being meticulous about my book. So when the 50% deadline came, I had my chapters but I was delayed on my clients.

Putting the book on the back-burner at the beginning of the 75% deadline, I spent time catching up on client work. As a week turned into two, and then three and I had not been able to start on the 75% deadline, I had mornings where I would have nervous and mental breakdowns in the shower. I had no idea how I could do it all. I was under intense pressure to do and I simply did not know if I could do it. I hid it well, but exactly one week before I had to have another nine chapters turned in, I began that process of writing those nine chapters. I told my clients I was unavailable. I locked myself away for 12-16 hour writing marathons. At 8pm on the day of my 75% deadline, I turned in my last chapter – a marathon effort that began 7 days before. I headed to the bar for a beer.

We got started on the process late, so although Wiley agreed to push back the 25%, 50% and 75% deadlines to compensate, the final deadline had to stay fixed at October 14. Two and a half weeks. I took a bit of time off to go back to client work because I knew I’d be going to Orlando to keynote IZEAFest, and had intentionally took advantage of the group rate that IZEA had negotiated to get a few extra days in sunny Florida. In theory, I could write the rest of the book by the pool and enjoy the sun. Good idea, but then the wifi was ridiculously poor and I lost six days in the two and a half weeks I had to finish things up.

I came back from Orlando looking at the same situation I had with my 75% deadline – 8 days to go, 9 chapters to write. Up until this point, I had made every deadline even if I was unofficially granted a few extra days here or there if I needed it. I never took those extensions. My editor was firm on the 100% deadline though. It must be done. (She ended up giving slightly in the end but I couldn’t take her up on that because I was leaving for Vegas and Blog World Expo on the day of my final deadline. There was no way to be in Vegas and take advantage of a few more days to write!)

Miraculously, as I flew at 37,000 feet on Virgin America en route to Blog World Expo, I was submitting my final chapter and screenshots. Thank God for wireless internet on flights! I made it. Done. Complete. Breathe.

When I got back from Vegas, however, my editor told me she needed me to rewrite a chapter (or significant portions of the chapter). Sighing heavily, I did just that addressing the areas of concern she had. Then the deluge of chapters began floating back to me for A.R. I had to sort through every single chapter, rewriting some portions, approving code changes from Mark Jaquith, my technical editor, wording and grammatical changes from my copy editor and other generalized suggestions and changes from my lead editor.

I was told that the edit process is grueling. That it is painful. That I better have thick skin. I went into A.R. expecting the worst. Fortunately, it was a fairly painless process. Perhaps after the marathon sprints and my inherent instinct to trust the people around me to make me look good, I rolled with the process. These people make me look good! While I accepted almost every suggestion from all three editors, there were times I vetoed. As the author, I have that prerogative to a point. Generally, however, I trust these people to help me through. It was not as bad as I expected.

Emotionally, I was numb. The book took a toll on me. In most ways, the toll is good. In other ways, perhaps not so much. I still will have to proofread the final product in December and will have a week to do so, but this process is all but over. However, I’m still numb. Does a man achieving what seemed so difficult to do give him an emotional outbreak, as we see when sports teams win the big championship, or does it make us look at life a little more soberly and say, “Wow… I did that. Crazy. Now what?” For me, I think it’s the latter.

From a business perspective, The Navstar project has been wrapped up for almost two months now. TheCityFix is all but wrapped up. When you’re writing, you don’t have time for business development. So now I’ve hit the reset button and rebuilding again. The buzz around the book has already generated enough leads that I don’t think I’ll be hurting for work.

From a book perspective, I can’t wait for this thing to come out. It is available on Amazon on February 15th and you can preorder it now. There will be a book launch in Baltimore and Washington, likely. I will undoubtedly be traveling to many WordCamps next year, including our own WordCamp Mid-Atlantic (which I co-organize). Next time I write a book, however, I will write it about something I want to write about and not something I’m qualified to write about. (kidding).

To aspiring writers, I say:

  • Find your groove early. Don’t waste time on stylesheets (every publisher provides a style guide). That’s what the editor is for.
  • Roadmap your book so it’s on paper. Most publishers will require a table of contents before you start. It’s for your good as well as theirs.
  • Have thick skin during the editing process. Your editors don’t hate you even if their markup seems like they do. They have your best interest in mind.
  • Have an agent! The agent is there to help navigate through the business process. Sure, they take 10-15% off the top, but they can often get you more money and more concessions. It’s sort of like don’t ever go to court without a lawyer.
  • Write because you want to write. You’ll never make it rich on writing (unless you’re Thomas Friedman, and even then, you’re probably making money from speaking engagements because of your writing).
  • Figure out the environment and mode you need to be in to effectively write.
  • If you need to stop because you’re mentally exhausted, stop… because you’re mentally exhausted. It doesn’t help your writing to be doing so in a robotic, bleary eyed way.
  • Most of all, have fun! Writing a book is a hard process, but so rewarding. If you treat it like work, it will be work. If you treat it as a way to channel your energies, you’ll have more fun doing it. :-)

10 Things You Need to Know About WordPress 2.9

Gentlemen, start your engines! WordPress 2.9 is just around the corner. Unlike WordPress 2.8, which Mark Jaquith describes as the Snow Leopard of WordPress since most of the basis of the WordPress 2.8 upgrade was complete rewrites and optimization of the infrastructure that ran WordPress instead of providing lots of new features in the same way Apple’s new OS X release is a focus on improved performance instead of features, WordPress 2.9 brings major new “bling” to the table. As a reminder of WordPress 2.8, you can see the writeup that Jonathan Dingman brought us last time around.

By and large, this release is a plugin developers release with lots of new APIs and abstraction. However, there are significant additions for theme designers and users as well. As a result, unlike previous iterations of this article (I do one for every major WordPress release), I’m going to break this down into sections for each kind of feature.

Themes: the_post_thumbnail()

Theme developers have a new piece of functionality that have become extremely popular in themes these days. As blogs have evolved from journal form into entities that can be very magazine-like, the use of thumbnail images has also grown. Typically, this layout is achieved through the use of custom fields that must be manually created and populated. No more!

As of WordPress 2.9, if you use the built in image uploader, then WordPress handle this for you. Theme designers that wish to support this feature can add the template tag the_post_image() to their themes to achieve proper placement as required by the theme layout. The template tag can optionally take a “size”, which is one of the WordPress default sizes: thumbnail, medium, large, etc. If none is provided, it defaults to your preset thumbnail size.


  <div class="entry">
    <h1>&lt;a href=&quot;"&gt;</a></h1>

Conveniently, if a theme is enabled for post thumbnails, the only “feature” currently offering this support in WordPress, then a new “meta box” will be displayed on the Write screen allowing you to assign a post image.

Themes: Register Support for WordPress Features

Editorial Note: Since this article was published, the code has changed to refer to post-thumbnails, not post-images. As a result, function names have also change. The code and examples included before reflect this change. Sorry for the confusion and sorry specifically to theme devs who have implemented the_post_image() feature already. Just change it to the_post_thumbnail()

This may seem to be an obscure feature, and typically, it’s pretty simple to figure out what I’m talking about just by looking at the header. In this case, it’s a bit more obscure because it suggests a feature that is introduced in WordPress 2.9 and then only for a very niche purpose. I can see this being built out over time, and plugin authors can supply their own use cases.

The concept is simple. If a feature exists “” in the core, the only use case is for the thumbnails I described earlier and it is called ‘post-thumbnails’ “” then a theme can declare support for the feature using the add_theme_support() function in the theme functions.php. It can only be declared in this file and it requires a feature be assigned a name. As I mentioned, with WordPress 2.9, there is only one feature that is named and that is post-image. Plugin authors can provide their own new functionality using the require_if_theme_supports() function.


Themes would then enable support for the feature by including the following in their functions.php file.

if ( function_exists( 'add_theme_support' ) )
add_theme_support( 'my-custom-feature' );

We’ve used the function_exists() check on the add_theme_support() function to ensure backwards compatibility with WordPress installations prior to WordPress 2.9. Similarly (and possibly confusingly in this context), before you would have to check for the existence of a plugin by using a function_exists() or class_exists() piece of logic and loading it if the class or function did exist, but now there are on/off switches to get it done.

Users: The Trash Can

On Windows, they call it the Recycle Bin. On Macs, it’s the Trash. In both cases, the feature exists to help people recover from accidental deletions. We have all had those moments where we nuked something we had no intention of nuking. With WordPress, accidental deletions have been permanent. In WordPress 2.9, everything is recoverable now with a new Trash feature. When you delete a post, page, category, comment, or any bit of content, it is moved to the Trash where you can decide whether to pull it back at a later date.

The Trash Can view. From here, content can be restored or deleted permanently.
The Trash Can view. From here, content can be restored or deleted permanently.

Trash collection is done every 30 days by default, but it is possible to change this by editing your wp-config.php file. Add the following to your config file to change trash collection to every 7 days. Modify as needed.


Users: Image Editing

One of the hot new features in WordPress 2.9 is image editing. Now don’t get me wrong. This isn’t Photoshop. And it only support basic functionality at this time. However, image editing will allow bloggers to crop, scale and rotate images from right within WordPress. From the media library, you can edit images by clicking the Edit link under an image, and then clicking the Edit button on the individual image page. This brings up an interface like what is shown below.

The WordPress 2.9 Image Editing Screen
The WordPress 2.9 Image Editing Screen

Users: oEmbed

oEmbed, as described at oEmbed.com, is a specification that allows media providers like Flickr, YouTube and others to provide data for consumer applications like WordPress about media. So by including an Embed (Use the File uploader and choose “From URL” and paste the link to the page that contains the media, not the media file itself) in a post or page, WordPress can retrieve the relevant specs on the media file and formulate a properly formatted embed accordingly.

Below is an embed of one of my Flickr photos using oEmbed.
Scenes from San Francisco

Below, is an oEmbedded YouTube video (Original video removed so here’s the Iron Man 2 Trailer).

If you don’t want to use the GUI for this stuff, you can simply wrap the URL to the media page in embed shortcode tags like this.


The list of supported oEmbed sites in WordPress are as follows:

  • YouTube (via oEmbed)
  • Blip.tv (via oEmbed)
  • Flickr images and videos (via oEmbed)
  • Hulu (via oEmbed)
  • Viddler (via oEmbed)
  • Qik.com (via oEmbed) “” never heard of this site, but it was listed on oEmbed’s website, so”¦
  • Revision3 (via oEmbed)
  • Google Video (via an internal handler)
  • PollDaddy (via an internal handler)
  • DailyMotion (via an internal handler)

That said, plugin authors can add new providers if they want by using the oembed_providers filter or override altogether with the WP_oEmbed->providers property.

Plugins: Custom Post Types

One of the strengths of Drupal has been its ability to have multiple types of contents contained in objects that all look alike to PHP. WordPress has supported a variety of content types as well, but it has not been nearly as flexible making WordPress a blog platform with some additional support for pages and attachments. Technically, the only post_types that WordPress has supported have been post, page, revision and attachment. While it has technically been possible to add new post_types (like podcast, mp4, or tutorials – they could be anything, really), it has been a chore and required plugin developers to handle quite a few moving parts in order to make it all work properly.

No longer. Plugin authors now have API to register new post types, opening up the possibility for even more creativity and uses for WordPress.


The get_post_type() function can only be used in the Loop. It returns the type of post a post is. Keep in mind, I’m using post loosely. All content in WordPress is kept in the posts table thereby inheriting the name “post”, but post is also a kind of content that is associated with blog content (as opposed to page which is a pseudo-static page, attachment which is information about an image or file uploaded with the media uploader, etc).


The get_post_types() function will return a list of all types of post content. By default, this will be post, page, attachment and revision. Refer to the source code for optional arguments that can be used to control what kind of data is returned.


As a plugin author, you can use this function to create a new post type. The first argument is the unique handle you want to assign to the post type – let’s call it podcast – and the second argument is an array that contains additional elements. The key one here is an exclude_from_search, which by default is set to true. You actually probably want to set this to false unless you really don’t want this additional content searchable. See below for example usage.

function wpb_podcast_init()
register_post_type('podcast',array('exclude_from_search' =&gt; false) );

There is currently no user interface for post types. There is a patch in for UI that will likely be included in WordPress 3.0.

Plugins: Comment Meta

There has been a variety of meta tables in WordPress. Meta tables, like usermeta or postmeta, are database tables that contain information about the type of data that is stored in WordPress. It allows plugins and WordPress to assign metadata, such as user roles and capabilities, to pieces of data thus extending that data. Now, there is a comment meta table as well.

Though it is unclear how plugin authors will seek to use this table, the fact that it is available is a major deal as it essentially provides meta tables for every piece of content in WordPress now.

Plugins: Metadata API

With the addition of a comments meta table, it has become effectively redundant to duplicate functions throughout WordPress. You have a get_post_meta() function that does the same thing as a get_usermeta() function except they query data from different tables that also look identical except for the data stored in them.

In WordPress 2.9, there is an entirely new Metadata API that can be used to retrieve data from any of these meta tables.

The add_metadata() function takes a meta type (‘comment’, ‘post’, ‘user’, etc), the ID of the content type, the key and value of the metadata and whether the information should be unique or not (true or false).

add_metadata('comment', 12345, 'twitter_id', 'someyoungpunk');

You can also use update_metadata(), delete_metadata(), get_metadata() and update_meta_cache() for further wrangling. Refer to wp-includes/meta.php for full documentation.

Themes/Plugins: Theme System Modification

A lot of messiness has been eliminated in WordPress 2.9 theming. For one, new template opportunities exist. Now, instead of looking for a template file called category-x.php, tag-x.php or page-x.php, where x is the ID of one of those types of content types, it will look for these templates second. The first template that is now looked for is based on the slug. So if you have a category, tag or page called foo, the first template to be sought after would be category-foo.php, tag-foo.php, or page-foo.php. If none of these templates exist, then the ID-based template file is looked for.

Additionally, plugin developers can register new directories for themes to be located with the register_theme_directory() function.

System: Database Repair Script

The database occasionally needs a good spring cleaning. Other times, the database needs a repair. WordPress ships with a new script that will do just this. It is housed at /wp-admin/maint/repair.php but in order to use it, you need to create a new (or modify if it already exists for some reason) constant in wp-config.php.


System: Minimum Requirements

PHP 5 is not required yet. That’s coming in WordPress 3.0 will be increasingly implemented over time. But MySQL requirements have been boosted from MySQL 4.0 to MySQL 4.1.2.

Bonus coverage

Other interesting things in WordPress 2.9.

  • JSON compatibility, before only beneficial to PHP 5.2, has been backported for use in WordPress
  • New ‘Undo’ button when using the Visual Text Editor
  • A new sanitization API (with functions like esc_html())
  • The emoticon system can be altered using the smilies_src hook. :-)
  • Bulk Upgrading of plugins
  • Filesystem optimizations pertaining to FTP/SSH etc.
  • rel=”canonical” for single posts and pages aiding in SEO
  • Minify Admin CSS making for quicker (and smaller) page loads
  • Bunny Tags and Jeromes Keywords Importers removed

WordPress Security and How I’m Going to Take All Your Money

So, it’s happened again. Another vulnerability discovered in WordPress that is now becoming the raging topic around the blogosphere. Is WordPress insecure? Should people move to another platform? If we stomp our feet loud and enough and whine enough, then we can make WordPress look like a ridiculous piece of software that only amateurs should use.

I call bullshit. Here’s why.

The current security paranoia is around an exploit that has already been fixed! That’s right, it was known and fixed two releases ago. The problem is, the people complaining about WordPress’ security are running old software. They didn’t bother to do the responsible thing and keep their blog up to date!

See, WordPress has two different types of releases. Major releases (2.5, 2.6, 2.7, 2.8, etc) provide new features. These releases keep the software innovative, bringing new functionality to bloggers every 4-6 months. Security releases (2.8.1, 2.8.2, 2.8.3, 2.8.4, etc) are arguably more important than major releases because they keep you safe!

Bloggers who ignore these security releases do so at their own risk.

And because of that, when you are hacked, I will charge you an assload of money to fix you up! Believe it.

There is nothing more I want to do on a holiday weekend that also happens to be my birthday weekend, than to fix peoples blogs who didn’t bother to take care of themselves. It’s personal responsibility. Oh, I’ll do it. You won’t like the bill, though.

If you’re using WordPress 2.7+, as said loudmouth blogger was, it’s so simple to keep things up to date with the auto-upgrade button. WordPress even informs you when your version is out of date and provides a direct link to the upgrade page. If you ignore that, it’s not my fault… it’s yours.

For clients hosted on my servers, you are up to date. Why? Because I make sure of it. For the rest of you, do your part, so I don’t have to. Because my part will be making your blog secure, but it will also be sending you a sizable invoice.

Cheers, and happy Labor Day!

WordPress Bible Book Tour

From the moment I announced that I would be writing the WordPress Bible, friends and fans all over the world have been asking me to come to their city to do an event. Clearly, I would love to do such a thing, but without tremendous support it is not in the cards.

However, more recently, as I’ve just reached my 50% writing deadline, I’ve thought more seriously about going on the road next year after the book goes on sale. (It’s slated currently for Feb 22, 2010 and you can pre-order the book now on Amazon for $31.49
– aff).
So here’s the deal. I am working on a sponsorship that would provide me a vehicle for a round-the-country 2-3 week book tour in late March, early April. I would like to visit 12-15 cities around the U.S. and Canada. Ideally, these are cities where there are a core of WordPress users and, ideally, where there has been a WordCamp (this denotes interest in the topic). Some of these cities might be:

  • Washington, D.C.
  • NYC
  • Boston
  • Toronto
  • Nashville
  • Columbus
  • Chicago
  • Dallas
  • Denver
  • San Francisco
  • Los Angeles
  • San Diego
  • Seattle

Each city needs to have a host who can organize the event, take care of expenses, etc. I would like to be able to host an open bar/reception time as well so sponsors probably need to be raised. Don’t get me wrong, this type of thing is probably not a break-the-bank kind of event. We need a venue (bookstore likely), venue (reception), maybe sponsors, my expenses, and someone to get people out.

If you’re interested in hosting in these or other cities, send me an email at aaron@technosailor.com.