Your code is being executed too early before the “base” query was evaluated.
As a thumb rule, in a plugin always hook your code to an appropriate hook, probably wp_loaded
is best if there is nothing more specific
Your code is being executed too early before the “base” query was evaluated.
As a thumb rule, in a plugin always hook your code to an appropriate hook, probably wp_loaded
is best if there is nothing more specific