[wp-hackers] to use or not to use a custom taxonomy

Haluk Karamete halukkaramete at gmail.com
Tue Nov 1 12:18:44 UTC 2011


So the recommendation is for every different categorization system, we
are better off using a custom taxonomy - except the main one ( most
probably the topics based on ) which should be best handled  with the
out of the box category taxonomy.

In other words, for a site planning to have various facets ( or browse
by options ) into the content, such as

browse site by Media
browse site by Audience Level
browse site by People
browse site by Places etc...

each browse by section shoukd be handled as a  custom taxonomy - and
preferably a hierarchical way.



I'm sorry but I still don't get the advantage of using CT's here as
far as usability...  I wish I could see this clearly. Cause seeing it
helps tremendously in the application phase.

As far as I see ( don't see :( ) , I can go either way and it won't
make a difference...
for example, it appears to me that if I add media, audience, people,
places as top level cats just like the topics, it's so much easier to
develop and run queries.
Perhaps, if I see the main advantage in using hierarchical CTs, I
would not be puzzled this much.

I see the difference between out of the box tags and those that are
under a non-hierarchical custom taxonomy. With that I see that I have
the advantage of qualifying the tags and bringing a perspective to the
matter. For example, as has been pointed out in this article (
http://www.ideaeng.com/taxonomies-ontologies-0602 ), I can take the
tag "GOLF" for instance, and bring a perspective as to in what context
I refer to the GOLF tag for the article at hand.

it could be tagged under “Human Activities" taxonomy     (  if the
article deals with golf as a Leisure activitiy as a sports.
it could be tagged under “Apparel" taxonomy     (  if the article
deals with golf as a Casual/Active Apparel -> Sporting Apparel -> Golf
Clothing and Accessories.
it could be tagged under “Consumer Electronics Taxonomy" taxonomy
(  if the article deals with golf as an Electronics -> Handheld
Gadgets -> Outdoor & Navigational -> Gadgets for Golfers.

If I were to not use CTs here and go with the built in tag taxonomy, I
would end up mixing all these 3 articles from one perspective; that is
 they all talk about GOLF. But, it would not be much user friendly.
It's like clicking on a tagged titled "apple" and getting articles
about fruits and computers... So I do see the power of
non-hierarchical CTs because I have no other way of achieving this
kind of abstraction but using CTs.

However, in the case of hierarchical taxonomies, I can easily get away
with not creating them and working with 2 additional category terms as
follows and I would still be fine.

Human Activities  ( top level category term  as opposed to a hierarchal CT)
--Leisure activitiy
----sports
------golf
Apparel  ( another top level category term as opposed to a hierarchal CT)
--Casual/Active Apparel
----Sporting Apparel
------Golf Clothing and Accessories.

Again the question, why create a hierarchical CT ever?


On your point on, adding a custom taxonomy does not slow the site
down..  well, I was referring to querying part...

it appears to me that there should be some performance differences in
the following two code snippets..

----------------------------------------------------
case 1
----------------------------------------------------
$myquery['tax_query'] = array(
	array(
		'taxonomy' => 'category',
		'terms' => array('sports'),
		'field' => 'slug',
	),
	array(
		'taxonomy' => 'media_taxonomy_here',
		'terms' => array('video'),
		'field' => 'slug',
	),
	array(
		'taxonomy' => 'audience_taxonomy_here',
		'terms' => array('beginner'),
		'field' => 'slug',
	)
);
query_posts($myquery);

----------------------------------------------------
and case 2 where I avoid additional CTs
----------------------------------------------------

$myquery['tax_query'] = array(
	array(
		'taxonomy' => 'category',
		'terms' => array('video','beginner','sports),
		'field' => 'slug',
	)
);
query_posts($myquery);


I appreciate all comments and leads to articles describing the perfect
use of hierarchical custom taxonomies.

Thank you...


On Mon, Oct 31, 2011 at 3:48 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> On Oct 31, 2011, at 10:16 AM, Haluk Karamete wrote:
>> when you display the cats, of course, you would not want to display it
>> as politics, sports, entertainment and then boom media (cat11)...
>> why? cause media is a whole different facet...
>
> Focus on what is most usable and don't worry about the JOINs.   So create a custom taxonomy called "Media."
>
>> here what I'm trying to understand is.... as I create more and more
>> CT's, my JOINs will be slower and slower...
>
> You misunderstand. Creating another custom taxonomy does not add a JOIN, unless you are querying by both Category and by Media in which case you'll have more JOINs either way you do it, maybe even more if you use subcategories.
>
> Worry about performance when performance becomes a real problem. Most of the time WordPress won't cause you performance issues unless you start trying to "out-think" WordPress' already built in optimizations.
>
> From [1]: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil"
>
> Hope this helps.
>
> -Mike
> [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize:
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list