Searching by Tag


As part of a plugin I am trying to search for all items that share a certain tag. I know how to search for items based on metadata, but tags are not part of the metadata, right? Should I query the items or the tags database, and what params do I need to pass into findBy() to get all items that contain a certain tag?

Thank you!

Something like this should work, on the Items table:

$items = get_db()->getTable('Item')->findBy(array('tag'=>'the_tag'));

You can see what params for findBy a table uses by looking at the table class for the model (in /models/Table) at the applySearchFilters method. That'll switch around the params that work.