ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was able to successfully show a custom field in the Playa list by adding this snippet to the views/entry.php:

<?=$this->db->select('field_id_XX')->where('entry_id', $entry->entry_id)->get('channel_data')->row('field_id_XX')?>

All works well to show and list the custom field, but the filter breaks? Anyone know where I can update the filter to show the correct items when filtering?


Did a little bit of digging after Alex mentioned the droppanes.js and filter_entries() method and it seems the filtering is done with AJAX as it queries the DB with the playa helper class: system/expressionengine/third_party/playa/helper.php.

share|improve this question
If it is the JS that is breaking I'm guessing it will be in /themes/third_party/playa/scripts/droppanes.js. Can you elaborate a bit on how it breaks (JS erros, behavior, etc)? – Alex Kendrick Dec 12 '12 at 22:44
The filter finds the correct entries if you type a title. If you try searching the custom field I've added, nothing shows/wrong entries. I added the custom field (model #) to the playa list to help differentiate the products (title). So when search for a model #, nothing shows – Siebird Dec 13 '12 at 1:54
Yeah, it looks like the query that is used to build the filtered list isn't going to consider a custom field. The place to start is the filter_entries() method in system/expressionengine/third_party/playa/mcp.playa.php. This gets called every time you type to filter. – Alex Kendrick Dec 13 '12 at 2:57
Thanks Alex. I just took a quick look and I think all the querying is done with system/expressionengine/third_party/playa/helper.php. ...Still beyond my expertise. Maybe someone with PHP chops can chime in. – Siebird Dec 13 '12 at 5:27
I asked this feature to Brandon some time ago, but it seemed to be more complicated than what I thought in the first place. I digged the code myself, but it looks like it's a big hard hack of Playa. – pvledoux Jan 24 '13 at 14:16

Obviously, modifying these files is not ideal and without some kind of conditionals you won't be able to reuse playa field types for anything else, but if you must here is what I did.

The 3 files that I needed to modify:

  1. system/expressionengine/third_party/playa/ft.playa.php
  2. system/expressionengine/third_party/playa/helper.php
  3. system/expressionengine/third_party/playa/views/entry.php

First, in ft.playa.php in the display_field method you need to change the query:

$query = $this->EE->db->query(
                'SELECT * FROM exp_channel_titles
                WHERE entry_id '.$this->helper->param2sql($vars['selected_entry_ids']));

to join on the exp_channel_data table and select your custom field. This is for your saved selected item(s).

Next, in helper.php in the entries_query method you need to change the query being built in a few places to join on the exp_channel_data table and select your field. This is for the available unselected options. Also, in the same method under

if (isset($params['keywords']) && $params['keywords'])

you have to add a search for your custom field. This code is executed when a user is typing in the multi-select playa field via ajax to filter out entries. The filter for the single select playa field is just a javascript regex so, in that case, you need not worry about this.

Finally, you need to print your custom field in the entry.php file.

share|improve this answer
Thanks Rick! Now I just have to remember what site I was trying to do this for ;) – Siebird Nov 26 '13 at 19:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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