• Resolved baz74

    (@baz74)


    I was trying to test why the following code was not doing as expected (see below), Firstly I tried ‘echo’, but found it isn’t allowed with WP. Then when searching forums I found your Plugin (Hooray!)

    I installed it, but didn’t understand the help text (I think it would be better if you added an example).
    Then I didn’t know where the output goes. I tried console, then looked at your plugin and found it. (I think it would be better if you explained where to look)

    $date1 = new DateTime( $list[ 'ga_event_start_date' ] );
    // do_action( 'inspect', [ 'variable_name', $date1, FILE, LINE ] ); // for testing
    $date2 = new DateTime( "today" );
    // do_action( 'inspect', [ 'variable_name', $date2, FILE, LINE ] ); // for testing
    if ( $date1 < $date2 ) {
    $list[ 'ga_event_start_date' ] = "" . $list[ 'ga_event_start_date' ] . "";

    Each time I changed & refreshed my test page, I then looked at your output, and only found one line reported.
    Then I tried refreshing your output page and found more, but I was never able to output more than one line – even by then I had found your ‘Refresh’ button – it too refreshed and only gave me only one line.

    So I commented-out lines, but got the same (commented out) line reported. Could your plugin be reading a cached version of my test code, rather than the live?

    After eventually outputting the values of $date1 & $date2, I added the following line to the end:

    do_action( 'inspect', [ 'variable_name', $list[ 'ga_event_start_date' ], FILE, LINE ] ); // for testing.

    It does not seem to work, have I got the variable name correct $list[ 'ga_event_start_date' )

    A BIG thanks for a VERY useful plugin!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bowo

    (@qriouslad)

    @baz74 there is a “How to Use” section on the plugin description page at https://www.ads-software.com/plugins/variable-inspector/

    In the inspection dashboard (Tools >> Variable Inspector), you can also find a small link in the footer “How do I use Variable Inspector”.

    You can only use $variable_name as the second parameter, not something like $vairable_parameter[‘array_key_name’] like in your last example. To inspect that, please define a $variable_name for it before hand. e.g.

    $ga_event_start_date = $list[ 'ga_event_start_date' ];
    do_action( 'inspect', [ 'ga_event_start_date', $ga_event_start_date, __FILE__, __LINE__ ] );

    You also missed the double underscore in FILE and LINE. Please also use the same ‘variable_name’ string, i.e. use it twice. In the example above, it is ‘ga_event_start_date’. I hope it is clear enough now.

    • This reply was modified 1 month, 4 weeks ago by Bowo.
    Plugin Author Bowo

    (@qriouslad)

    p,.s. if you find Variable Inspector useful for you dev work, please kindly consider write a quick, 5-star review for it. You can simply copy what you wrote above: “A BIG thanks for a VERY useful plugin!!”. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.