I guess the problem is
$qry = new WP_Query(array('category_name'=>$GLOBALS['city'],'order'=>$orderby));
Let’s just say $orderby is orderby=title&order=ASC
Then the order argument of WP_Query will be like this:
'order'=>'orderby=title&order=ASC'
However, order argument only accepts: ASC and DESC.
You should do somethings like this:
WP_Query('category_name=".$GLOBALS["city'].'&'.$orderby);
Related Posts:
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- How to WP_Query posts order by parent title?
- Ajax filter with loadmore button
- Querying posts based off a jquery datepicker
- Query category-specific, paginated posts and allow viewer to change sort order
- have_posts() execution failure
- How to show a dynamic_sidebar if main content content’s height is > a set amount?
- How to filter posts by post format “standard” from wp-json api?
- Why is variable not working on custom sql query using wpdb?
- How to test nonce with AJAX – Plugin development
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Can’t search posts using WP_QUERY inside AJAX Function
- How to query for pages/post depending on slug?
- Woocommerce add to cart quantity buttons with AJAX
- How can I use wp_query to show all product data using just the products ID?
- js file in root loading without
- hover image appears below placeholder instead of overlayed
- combine Code 1 with Code 2
- WooCommerce – Reset quantity input field when variation changes
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- class click counter save number
- Random order of WP_Query results with highest meta value
- Custom page archive query by url var calling page twice on one of my custom queries?
- WordPress custom slug (endpoint) and compare all links
- Slider loading issue
- Checking for new message using AJAX and PHP. Server overload?
- jQuery not defined
- How to query for posts with a null or blank post_name?
- WordPress pagination not working with search page
- AJAX request status 200 but no actual “response”
- get current custom post ID by WP_Query method
- Conditional Header in wordpress
- Automatically remove a canceled order in Woocommerce
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Using foreach loop breaks
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- How to select the contents in the text view textrea in wp_editor?
- Create WP_Query to search for posts by their categories or their parent/child categories
- WP Query with custom Shortcode
- wp_query with cat not working
- wordpress count link clicks by ip address
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- How to use an associative array in post__in with WP_Query?
- Proper syntax or method for keeping url in modified isotope / category links
- ajax, right way to do it and make it works?
- If Query In Sidebar
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Compare post-IDs within WP_Query? (Less than / Greater than)
- Sort query_posts for Parent Pages to menue order or the count?
- Is there a way to programmatically create multiple pages utilizing the same template but different content from a json file?
- Ajax load more posts with multiple tax query
- WordPress Sending data to Ajax with select option
- How to use $query->set with post__in?
- WordPress ajax doesn’t display object method on jQuery .change() function
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Ajax loaded form replaces form action with Ajax url
- prevent default not stopping page refresh. Passing form information to and from php with ajax in a wordpress site
- How to design a table based on css values set from admin/dashboard
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- Dynamic content based on a URL parameter
- Adding Custom Slider
- Display a specific category of products in shop page and disable code for specific actions
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Ajax date_query not working past the first iteration
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Remove the first 5 characters of the_title and orderby that
- Add more button if more 8 items
- How to store post ID’s in cookie or session to display the same posts later
- AJAX pagination, update current page
- Limit Widgets to Sidebar ID’s
- Save Search System
- how to fix error “called incorrectly, should not be accessed directly”?
- adjust section according to country?
- populate form fields in a loop with ajax
- dynamic dependent select dropdown
- WordPress, AJAX and pre_get_posts using conditional tags
- Change “add to cart” button color based on Woocommerce product category [closed]
- How can I get the values of my WordPress $wpdb query in Jquery?
- Ajax request returns ‘Array’. How to output the actual results?
- Get users that likes the post
- Ajax load more button for comments wordpress
- Slick + PHP + ACF + JQuery slide reveal not working
- How to add a do_action on refreshing of WP customizer?
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Exclude posts based on meta value
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Set Order Status to Complete After Payment – from another site
- Gravity form built in Captcha
- Menu jumping when calling it via PHP
- Custom query, checking values of multiple meta keys
- Setting value of session with Ajax not working
- Click a radio button must set textfield value
- comments sorting incorrectly across multiple pages
- WordPress Multiple Navigation bars
- auto-populating custom nav with all items from custom post type
- inserting a post from an extern php file but post content doesn’t show on wp site
- [jQuery]Adding shortcode