WordPress Q & A: Week of July 5th, 2010

Brad asks:

What’s the optimal way to store large amounts of meta data for a taxonomy without creating a custom table in WordPress?

WordPress has meta tables for the site (options table), posts, comments and users. It lacks a table for meta data about taxonomies (categories, tags, custom taxonomies). Solutions for this aren’t going to be simple, but I can think of a solution that doesn’t create extra tables. You could create a “shadow” entry in the posts table for each term, using a custom post type (say, “taxonomy-meta”). Then, just attach meta key/value pairs to that post entry.

As for linking the post proxy entry to its corresponding term, you could use the taxonomy system to place that term within that taxonomy, but it would probably be much faster to appropriate one of the existing fields, since this is a one-to-one relationship. I’d probably use post_name and make it something like taxonomy-meta-term-{$term_id}. That way, it’d be fairly straightforward to grab the proxy object that corresponded to a particular term.

I’d create four API functions. One backend function to get the post ID of the proxy object corresponding to a particular term. A backend function to create a proxy object for a term if it doesn’t exist. And then one to update taxonomy meta, and one to get taxonomy meta.

It sounds complicated, but it shouldn’t be more than 30-40 lines of code. And your API would be simple. Share the code if you end up doing this!

“K. K.” asks:

Can you explain how to become a core WordPress developer like you?

WordPress is a meritocracy, so to get the “props” you have to show your worth and put in the time. Start by lurking in Trac and seeing how we develop. Observe the weekly WordPress meetings in #wordpress-dev on Freenode. Then, when you feel confident, start submitting patches to Trac on tickets that need them. Or test the patches that are up there. Follow the tickets and respond to feedback. People who consistently provide quality patches and who seem to “get” the WordPress principles (e.g. options are bad, keep core light, target the 80% need, etc) will rise fairly quickly in prominence.

Ted asks:

Are there any plans to incorporate Facebook connect or any of the other 3rd-party authentication mechanisms into WordPress? If not, are there any FB connect plugins you’d recommend — ideally ones that work for both WP and BuddyPress?

Facebook Connect — no. We might consider third party mechanisms like OpenID+OAuth, but they’re not on the short-term roadmap. The most popular Facebook Connect plugin seems to be WP-FacebookConnect, written by a Facebook dev Simple Facebook Connect.

16 thoughts on “WordPress Q & A: Week of July 5th, 2010

  1. Personally, if I wanted to store alot of taxonomy metadata I would also consider using the generic metadata api to store in a taxonomy metadata table in a way which could be used by a number of different plugins.

    These generic api functions handle everything for you apart from the creating of the db table from memory

    1. I think of situations where both methods would work swimmingly. Mark’s idea would probably bode better long term, since you gain all of things that posts get. Suddenly you inherit revisions, authors, thumbnails, etc…

      If we just consolidated the WP tables into object/meta/meta-meta tables, this would be lots easier. 😛

  2. I really need an easy to use WordPress skin that can get me started without tech support. I need to be able to easily upload photos and text. I need to include a donate/paypal feature. It is a time limited project and I am already feeling anxious about the time I am wasting just trying to get started. Do you have a recommendation for the best easy to use interface for a photo and text-rich not-for-profit site aiming to raise money and volunteer support. It would be great if it were free or at least offered at a not for profit rate. Thanks very much.

  3. I wanted to store alot of taxonomy metadata I would also consider using the generic metadata api to store in a taxonomy metadata table in a way which could be used by a number of different plugins.

Comments are closed.