Taxonomy or post meta? (2 posts)

  1. iLobster
    Posted 6 years ago #


    I am creating a plugin that is using custom post types to store custom data. I need to store additional information for each item, and was wondering witch is better for storing my custom information taxonomy or post meta.

    The custom information is:
    1. Tags.
    2. a few sets of text values selected from predefined options, some of witch are
    multiple choice.

    My question is, witch of these approaches makes more sense structurally, and with witch one will the load on the database be lighter when pulling up to 30 items per page?

    Thanks in advance.

  2. Joel
    Posted 6 years ago #

    Can't help on query efficiency, but as a general rule, use of a taxonomy is probably preferable in circumstances where the taxonomy "terms" will be present multiple times (this seems to be the case for both #1 and #2 in your example).

    For instance; if your custom post_types all have "measurements" (a "key" in terms of post meta), but the "value" of those measurements are all (or mostly) unique, using post meta would be more logical. Alternatively, if the "values" are recurring, using custom taxonomies would give you more flexibility within WordPress.

    To analogize; "key" is to "taxonomy" as "value" is to "term", for post meta and custom taxonomies, respectively.

    Using taxonomies also provides you with some nifty native WP functions.

Topic Closed

This topic has been closed to new replies.

About this Topic