• Resolved meksONE

    (@meksone)


    Hi, i’ve used this plugin some time ago without problems; now I need it again but I’ve noticed a strange behavior… even on a fresh WP without plugins, if I run a simple test like this:
    $test = is_home();
    return $test;
    on the homepage, it returns FALSE.

    I’m missing something? Where I’m wrong?
    Thanks!

    • This topic was modified 4 years, 8 months ago by meksONE.
Viewing 1 replies (of 1 total)
  • Plugin Author Fulvio Notarstefano

    (@nekojira)

    is_home() is returning correctly false because you are not on the homepage, the WP_Query object it is tied to understands that. You are calling this function from the console context, and it cannot be used in this way. Functions that depend on some WordPress states or globals, will not behave as if you were inside the WordPress loop.

Viewing 1 replies (of 1 total)
  • The topic ‘WP Function returns wrong results’ is closed to new replies.