• Hi,

    I was told I’m supposed to do a “var_dump” to find out exactly how a field on the WP Post Editor is expected to be “output”

    Using very simple terms, could someone please explain to me what is a “var_dump”?
    Also, how would I perform a “var_dump” on a specific field from the WP editor?

    I tried googling it but it only got me more confused lol.

    Hope you all could help me out.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there!

    var_dump() is a PHP function, it’s used to print out the content of variables. To use it, you’d need to put it in the right place in the PHP code you’re writing, it would look something like this:

    var_dump( $field );

    Where $field is the name of the variable you’re dumping.

    It’s not possible to give more specific advice about how you should use it without knowing the context – are you writing a plugin? Do you have an example of the code you’re writing? (Please upload examples to https://pastebin.com/ , then link to them from your post, rather than pasting them directly in the forum).

    Thread Starter The Wachamacallit

    (@ineed-help)

    Hello Gary,

    Thank you so much for your reply.

    “print out the content of variables” … …?
    (please excuse my ignorance)

    No, I’m not writing a plugin.
    I’m supposed to do a Var Dump on a meta box in the post editor back end.
    “so that I can see exactly how that field is expected to be output”

    So, I think it would be:
    var_dump( $gmb_lat_lng );

    But where do I insert that?
    Do I place it in the actual meta box field?

    So, this is getting heavily into programming territory – debugging how the code is working can be a fairly complex process, which often requires a large amount of programming experience.

    Unfortunately, it’s not as simple as putting the var_dump() call in the meta box field.

    Where did you get the recommendation to use var_dump()? The person who told you to do this may be able to give you more detailed information about why they need the var_dump() output, or alternative methods to find the information they need.

    Thread Starter The Wachamacallit

    (@ineed-help)

    Got you, Thank you for the info Gary,
    I’ll inquire some more to them and post back here if I find a solution.

    … how would you do a Var_Dump on the Title Field of the WP Editor in the back end?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What's a "var_dump" and how do I do it?’ is closed to new replies.