I'm having a great deal of trouble phrasing this.
If I were to use the filter
views_edit-page
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
add_filter('views_edit-page','addFilter');
function addFilter($views) {
var_dump($views);
die();
}
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?
I'm having a great deal of trouble phrasing this.
If I were to use the filter
views_edit-page
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
add_filter('views_edit-page','addFilter');
function addFilter($views) {
var_dump($views);
die();
}
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?
Share Improve this question asked Jun 5, 2019 at 1:45 peter kpeter k 54 bronze badges 3 |2 Answers
Reset to default 0Perhaps 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&post_type=page">Published <span class="count">(1)</span></a>'
)
/wp-admin/edit.php?post_type=page
. – Nathan Johnson Commented Jun 5, 2019 at 17:05