I need to do a var_dump in a custom function filter in WP but, where is the results shown? The code is working because I can see the search result structure difference from when the code is present and not
add_filter('relevanssi_hits_filter', 'products_first');
function products_first($hits) {
$types = array();
$types['section1'] = array();
$types['section2'] = array();
$types['section3'] = array();
$types['section4'] = array();
// Split the post types in array $types
if (!empty($hits)) {
foreach ($hits[0] as $hit) {
array_push($types_1[$hit->post_type], $hit);
}
}
// Merge back to $hits in the desired order
var_dump($types);
$hits[0] = array_merge($types['section1'], $types['section2'], $types['section3'], $types['section4']);
return $hits;
}
shutdown
hook can be used to render before closing body tag:Try killing the flow right after the var_dump, that ussually helps me debug easier:
That way if something after your var_dump is rendering on top of the var dump it wont get covered by it.