In my previous post about Wordcamp Dallas 2008, I mentioned my encounter with the founding developer of WordPress and his advice that I took action upon. Here are the results, beginning with details of how this site operates and the problem presented by such a setup.
Each page or post in WordPress can be tied to one re more custom fields, where numbers, strings, or booleans can be tied to that one specific post. Such fields are made unique by the combination of post ID, custom field ID, and custom value.
This particular website depends heavily on custom fields to create the relationships (e.g. links) between the main story pages and the individual story parts. In turn, those story parts use custom fields to define which characters and locations appear in the tale. For example, on a story part featuring two characters, the custom fields would appear
like this, with the custom values representing the ID of the page for that character/location.
Generating relationships in this manner was required in my early days of WordPress, as I was unfamiliar with the application and it appeared to follow the path of least resistance to a quick go-live. Along the way came a new version of WordPress, and with it the concept of tagging. Tags are terms associated with or assigned to a piece of information. Both Flickr and del.icio.us users are already well-acquainted with this concept.
After his keynote speech, Matt Mullenweg was gracious enough to spend a few minutes with me, patiently listening to how I used WordPress to create the mixes of short story and book found on this site. He found the concept quite interesting, which is encouraging to someone looking for any support he can find in the blogosphere.
However, when he heard how I was using the custom fields to link posts, he blanched and wondered why I wasn’t using tags instead. For example, he said, I could tag a post with the names of the people and places involved. Then in turn, those tags could be used to generate a variety of cross-post links across my site, either to tag-specific archive pages or a list of related content displayed alongside each post. And as illustrated in later WordCamp sessions that day, search engines love tags.
Believe me, I was far from resistant to using tags. However, there were enough posts on this blog that it would require some work to migrate off my system of using custom fields. So for the rest of Saturday afternoon, while I listened to more sessions, I went about writing the scripts necessary to move data from the wp_postmeta table to the new taxonomy table structures (wp_terms, wp_term_relationships, and wp_term_taxonomy).
The work was done swiftly, and the migration worked like a charm. As of now, if you’re reading a story on this website, the character and location links you see in the sidebar are now powered by tags instead of custom fields.
Custom fields are still being used for other purposes that tagging doesn’t logically replace, such as linking story parts to their main story page. Otherwise, the switchover has been clean and refreshing. I’ve noticed that writing posts is easier now that I don’t have to dig through the admin panels for post IDs. My next steps are to modify my site theme to display the tags alongside their posts, followed by display of other posts using those tags.
I wanted to thank Matt for taking the time to speak with me. His suggestion, however brief and obvious, is much appreciated and should help make my website more functional in the future.