How to run query inside a class with namespace?

I tried to run a query inside a class

this was the structure

namespace NCK{

class Runquery{
public function execute(){
$query= new WP_Query(array(…………..));
return $query;
}}}

But when i used

$getvalue = new NCKRunquery();
var_dump($getvalue->execute());

It throws an error

Fatal error: Uncaught Error: Class ‘NCKWP_Query’ not found in

is there any way i can make it works?

Read more here:: How to run query inside a class with namespace?

Leave a Reply

Your email address will not be published. Required fields are marked *