Hello,
I am trying to decide whether to use Custom Fields or Taxonomies (Hierarchical) on CPTs and I wanted to know if there would be any difference in terms of performance when I will then use the Views plugin to display custom searches.
There are a number of pros and cons to each in my use case, but at scale, when I will display them using Views, would there be any advantage at all in using one or the other? People will be able to filter results based on them, and some views will only display items belonging to "categories". If there will be a difference in terms of performance in using Taxonomies or Custom Fields to implement "categories", then I will choose accordingly 🙂
Many thanks!
Best,
- Julien
In terms of displaying a post or a View of posts, not much of a difference.
In terms of search, in most sites you're not going to see a difference in search queries for a moderate number of posts. At a scale of many, many thousands of posts with many, many custom fields in each post, you may begin to see some performance improvements with taxonomies over custom post types when you perform searches because the postmeta table (where custom fields are stored) is not indexed. Taxonomy searches require one or two subqueries, but the tables are more aggressively indexed.
In terms of administration, I find the WordPress taxonomy interface in a post editor to be quite handy because it provides autosuggest (typeahead). Types custom field editors do not include this feature, so you must either set up a select field with many options in advance, or predefined checkboxes, or some other system to make sure you manage the possible values effectively.
I hope this helps you make the best decision for your site's needs. Let me know if I can offer any additional assistance here.
Many thanks Christian, that perfectly answers my needs 🙂
Best,
- Julien