2

I would like to use a custom playa field as a search parameter in my EE channel entries tag, something like this:

{exp:channel:entries 
                        channel="media_images" 
                        search:media_v_location="Denver"
                        status="open" 
                        dynamic="no"
                        disable="categories|category_fields|member_data|pagination"
                    }

I have the field set as searchable. I presume I should be passing in the {title} of the entry and not the {entry_id}?

3 Answers 3

3

You actually can search on playa fields if you've ticked the "Is field searchable?" for the field. I believe the title or entry id of the related field can be used in the search.

For example, both should work:

{!--with channel entries--}
{exp:channel:entries 
    channel="your_channel" 
    search:playa_field_name="an_entry_id"
}
    {title}<br>
{/exp:channel:entries}

{!--with playa--}
{exp:playa:parents 
    channel="your_channel" 
    search:playa_field_name="a_title_keyword"
    field="playa_field_name"
}
    {title}<br>
{/exp:playa:parents}
3

According to the docs http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#search-field-name only fields of the type “Text Input”, “Textarea”, and “Drop-down Lists” are searched with this parameter.

1
  • This is true, but a lot of 3rd party fields, behind their custom interfaces, represent themselves to EE as one of these field types, so it's worth a shot.
    – Tim
    Sep 3, 2015 at 17:30
2

I have written an add-on that helps filter channel entries by their Playa relationships. If the solution above doesn't quite do it for you, check out PaternitEE on Devot:ee.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.