• 5
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Wordpress var_dump in functions.php

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;
}
      • 2
    • inspect the html source, the browser is probably interpreting it all weird. YOu can put a pre tag before it and exit afterwards also to help make it visible in the browser

shutdown hook can be used, add this code to functions.php:

function custom_dump($anything){
  add_action('shutdown', function () use ($anything) {
    echo "<div style='position: absolute; z-index: 100; left: 30px; bottom: 30px; right: 30px; background-color: white;'>";
    var_dump($anything);
    echo "</div>";
  });
}
  • 2
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions