I want to fetch selected fields in WP_Query Class in WordPress. I didn't find any argument for the same.
args=array('tag' => $tagname,'showposts'=>$no_of_post,'caller_get_posts'=>1);
$my_query = new WP_Query($args);
I need only title and description of the post. How to pass selected field in WP_Query function ?
I do not really understand the question, but I will try to answer .
First of all, WP_Query is not a function, it is a class.
So after you do
$my_query = new WP_Query($args);
the class object is available.That means that after setting up the data , you just use it normally if you want a loop for example :
or
$post->ID
after setting the post data ( or$post->title
)Or access it directly :
$my_query->post->ID
All the post details are available normally, But I am not sure what you mean about
description
, do you meanexcerpt
??