• Hi;
    when you want to make your own plugin or looking at plugin code that are available here,
    there are some variable in it which is global,
    how can I find the value of it, or all the variable the wordpress has,

    one that I am interested now is $word,
    does the value is number of words, or what?
    thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I usually use a tiny debug tool called dd() which enables me to debug-dump the contents of any variable by embedding it into the HTML output. All you nned to do then is view the source in your browser to inspect the contents. It works with simple variables, arrays and objects:


    function dd($var, $cap = 'var') {
    echo "<!-- $cap = ";
    print_r($var);
    echo " -->n";
    }

    To use it just do something like dd($word, "word"); anywhere in your PHP code or template.

    Thread Starter manou

    (@manou)

    thanks for reply,
    it gives me an error on the function:

    Parse error: syntax error, unexpected T_FUNCTION in /home/mysite/public_html/wp/testing_loop.php on line 16

    line 16 is:
    function dd($word, $words ) {

    here is all:
    <? php
    function dd($word, $words ) {
    echo “<!– $words = “;
    print_r($word);
    echo ” –>n”;
    }
    ?>

    thanks.

    no no no. copy HIS version of the dd function, then CALL it with the parameters as he specified. You went and REWROTE the function. also make sure there’s no space between the ‘?’ and ‘php’.

    offhand, I’ve never heard of $word as a main variable of wordpress core… doesn’t mean it isn’t, I just haven’t run across it in 2.5 years. 😉

    -d

    Doing a quick “grep” of the WP core shows that the variable “$word” exists in classes.php, comment-functions.php, functions-formatting.php, functions-post.php but it certainly doesn’t appear to be of any real significance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘what is the value of $word in wp’ is closed to new replies.