I'm getting an error from BuddyPress that seemsSpecifically, is it valid to be being triggered by creatingrun a new WP_Query()
during the plugins_loaded
action. The query runs fine and does what I want, but I'd like to know if I'm doing it wrong, or if BP is in error here.
Alternatively, is there a parameter I can pass to the query to tell it not to try to retrieve user info? I couldn't see anything in the documentation for the class, but then the no_found_rows
parameter isn't documented there either.
The BP error is:
Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init()
My plugin includes a class that includes the following code in the __construct()
method:
add_action('plugins_loaded', array($this, 'getDocs'));
This is the getDocs()
method:
public function getDocs()
{
$args = array(
'posts_per_page' => -1,
'post_type' => 'document',
'no_found_rows' => true,
'fields' => 'ids',
);
$docs = new WP_Query($args);
wp_reset_query();
$this->docs = $docs->posts;
}