Open chickenn00dle opened 5 years ago
This is a bit frustrating because, as the OP mentioned, it isn't anyone's fault. These plugins are hooking into the attributes assuming it will be during page generation, which is normally safe for conditionals since the query is done.
In our case, we run it for a blocked login page so there is no query. I suppose we could mock up a query or investigate if there is an alternative for the same use, or be very opinionated and remove filters?
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
*From #2377058-zen
I am not entirely sure this is exactly your problem, but I have at least two other plugins that are logging warnings when debugging is turned on saying that they are 'doing it wrong'. I inserted code to create a backtrace, and see that when this happens it is triggered by Jetpack.
For example, here is one:
The other one is similar, in which their code is being called as a result of the 'language_attributes' being called when outside of the $wp_query.
I am not sure why this is happening, or if you can change your code to unhook or bypass that filter if you are doing something when $wp_query is not defined?
One of the developers (Temple Invaders) gave me this information:
Here was another backtrace that triggered a similar problem in another plugin:
Both of them seem to be triggered by the same Jetpack module/function.
In looking further, it seems that you may only be calling language_attributes() for when you output the page.
It is frustrating, though, that this is rippling through and causing these messages in the debug log and there is seemingly no way to get it resolved because it is “nobody’s fault”.
Any thoughts on how to move this forward if it is not something you can address would be helpful. :)