Add where clause in query run time
-
Hi All,
Here is my page https://www.godfathercoupons.com/index.php?search-class
It gives output with following query :-SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) LIMIT 0, 10
I just want to add order by in that query order by post_title desc
How can I do that? because I do not know from where the query is getting generated.I used the following :-
global $query_string;
query_posts( $query_string . ‘orderby=post_title&order=ASC’ );& then if I am echoing a query like echo $wp_query->request;
It is giving the same query as previous no change.Thanks
Kaushal[mod note: don’t bump your topic, it is not permitted on these forums]
- The topic ‘Add where clause in query run time’ is closed to new replies.