I have a project that is using Views PHP, and I'd like to figure out which views are using PHP from this module. This will help me determine if I can easily remove the dependency on the module.

Is there a query or something else I can use to figure out what views are using this module?


Using the PHP filter in the fields should require you to use <?php ?> tags as part of the content.

The views data (unless its been exported with features) will sit inside the cache_views table in your DB, so you should be able to reliably find views using PHP filter by searching like so:

SELECT * FROM cache_views WHERE data LIKE '%<?php%';

There is probably a more sophisticated way of finding this.. but hopefully its a good start!

  • This is a cache, so data is not guaranteed to be there. For example, if the cache was just cleared, it will be empty. – mbomb007 Aug 2 '19 at 14:52

Searching cache_views as this answer suggested is a partial solution that helps, but a full solution will include views that are not cached.

In order to do this, you can export views to code (e.g. using the Features module), and search the views for 'php' or php to find Global: PHP fields and sort criteria.


Searching the views table directly seems to be best approach:

  views_display d
  views_view v
  d.display_options LIKE '%<?php%'
ORDER BY v.name;
| vid | name                                         | display_title                 |
| ID  | VIEW MACHINE NAME                            | VIEW DISPLAY NAME             |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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