I'm having a great deal of trouble phrasing this.

If I were to use the filter


How can I see what exactly is being passed through the filter so that I may edit them? Normally I would var_dump something similar to this, to get a breakdown of it's contents, but due to it being a filter, this does not seem to work.

For example


function addFilter($views) {

Is what I'd like to do, so that I may see exactly what $views consists of, in order to edit them. However, this does not work, what is a method I can use in order to see the content of $views?

  • Do the answers at wordpress.stackexchange.com/questions/149143/… help? Jun 5, 2019 at 2:24
  • Kind of, It modified the contents of the Filter, but does not provide a way to see what the contents actually are. I don't quite understand how they are able to make modifications to the data of the filter without first being able to see what the data consists of.
    – peter k
    Jun 5, 2019 at 3:23
  • Your code works for me. Make sure you're on a page where the hook actually fires. /wp-admin/edit.php?post_type=page. Jun 5, 2019 at 17:05

2 Answers 2


Perhaps you could push the variable contents to error log for later inspection? Like so,

function addFilter($views) {
    // error_log is native php function to log stuff
    // print_r prints human-readable information about a variable, 
    // print_r second parameter makes the function return result instead of echoing it
    error_log( print_r( $views, true ) );
    return $views;

The views_edit-page filter returns an array of strings. By default this will be something like this:

array (
  'all' => '<a href="edit.php?post_type=page" class="current" aria-current="page">All <span class="count">(1)</span></a>',
  'publish' => '<a href="edit.php?post_status=publish&#038;post_type=page">Published <span class="count">(1)</span></a>'

Your Answer

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

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