Get Post Object before $wp_query is set
-
Hello Guys,
im struggeling with getting the current post object in the filter “option_active_plugins”. The gloabls for $wp_query, $post,… are not set at the time the filter is called. So while WordPress needs to set them based on some data too, I was wondering how one would get the current context before the $wp_query is set (which therefore makes most of the relevant wordpress functions unusable).
Note: Im running the filter function in a mu-plugin, so it get’s called early enough. I thought this wouldn’t be a problem. Also the documentation on the “option_<name>” filters has example code using wp_query functions. What makes my filter so special?
Here is the register code, loaded in a mu-plugin:
function pr_disable_plugin_routine($plugins) { global $wpdb,/*set*/ $wp_query; /*not set*/ ... return $plugins; } add_filter( 'option_active_plugins', 'pr_disable_plugin_routine' );
I’ve allready tried every global I could imagine, to at least grab an id from an index.php redirect or something like that. No solution so far.
Thanks in advance
- The topic ‘Get Post Object before $wp_query is set’ is closed to new replies.