You need to add a \
in front of the WP_Query
call to tell PHP that it’s in the global namespace and not the namespace of this class.
Try this: $query = new \WP_Query($args);
You need to add a \
in front of the WP_Query
call to tell PHP that it’s in the global namespace and not the namespace of this class.
Try this: $query = new \WP_Query($args);