Order by in $wp_query Not working
-
Hello,
I want to order my posts in my theme to a specific field.
$args = array( 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => 'title', 'category_name' => 'casino', 'orderby' => 'AmountOrder', 'order' => 'DESC' ); $wp_query = new WP_Query($args); echo "Last SQL-Query: {$wp_query->request}";
This is not working and is just ignored:
The result i get it:Last SQL-Query: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (3) ) AND wp_posts.post_type = ‘post’ AND ((wp_posts.post_status = ‘publish’)) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
Why is this not working? and how to fix this?
Is it possible a plugin is interfearing with this:
The list of plugins i use are:Plugin Description
Select Advanced Code Editor
Advanced Code Editor
Deactivate | Edit
Enables syntax highlighting in the integrated themes and plugins source code editors with line numbers, AutoComplete and much more. Supports PHP, HTML, CSS and JS.Version 2.2.6 | By BaInternet | View details | Other Plugins by this author | Plugin Support | Donate
Select Advanced Custom Fields
Advanced Custom Fields
Deactivate | Edit
Customise WordPress with powerful, professional and intuitive fieldsVersion 4.4.2 | By Elliot Condon | View details
Select Advanced Custom Fields: Repeater Field
Advanced Custom Fields: Repeater Field
Deactivate | Edit
This premium Add-on adds a repeater field type for the Advanced Custom Fields pluginVersion 1.1.1 | By Elliot Condon | Visit plugin site
Select Advanced Custom Fields: WP WYSIWYG
Advanced Custom Fields: WP WYSIWYG
Activate | Edit | Delete
Adds a native WordPress WYSIWYG field to the Advanced Custom Fields plugin. Please note this field does not work as a sub field.Version 1.0.0 | By Elliot Condon | Visit plugin site
Select Akismet
Akismet
Activate | Edit | Delete
Used by millions, Akismet is quite possibly the best way in the world to protect your blog from comment and trackback spam. It keeps your site protected from spam even while you sleep. To get started: 1) Click the “Activate” link to the left of this description, 2) Sign up for an Akismet API key, and 3) Go to your Akismet configuration page, and save your API key.Version 3.1.1 | By Automattic | View details
There is a new version of Akismet available. View version 3.1.3 details or update now.
Select amr shortcode any widget
amr shortcode any widget
Deactivate | Edit | HELP
Include any widget in a page for any theme. [do_widget widgetname ] or [do_widget “widget name” ] [do_widget id=widgetnamedashed-n ]or include a whole widget area [do_widget_area]. Please read: Installation and FAQ.Version 2.6 | By anmari | View details
Select Contact Form 7
Contact Form 7
Settings | Deactivate | Edit
Just another contact form plugin. Simple but flexible.Version 4.2.1 | By Takayuki Miyoshi | View details
There is a new version of Contact Form 7 available. View version 4.2.2 details or update now.
Select Disable Comments
Disable Comments
Settings | Deactivate | Edit
Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.Version 1.3.1 | By Samir Shah | View details | GitHub
Select Ditty News Ticker
Ditty News Ticker
Deactivate | Edit
Ditty News Ticker is a multi-functional data display pluginVersion 1.5.6 | By Metaphor Creations | View details
Select Enhanced Text Widget
Enhanced Text Widget
Deactivate | Edit
An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, Shortcodes, and/or PHP as content with linkable widget title.Version 1.4.5 | By Boston Dell-Vandenberg | View details
Select Get Widget ID
Get Widget ID
Deactivate | Edit
Get ID of any active widget.Version 1.0 | By a.ankit | View details
Select Hello Dolly
Hello Dolly
Activate | Edit | Delete
This is not just a plugin, it symbolises the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page.Version 1.6 | By Matt Mullenweg | View details
Select MailPoet Newsletters
MailPoet Newsletters
Deactivate | Edit
Create and send newsletters or automated emails. Capture subscribers with a widget. Import and manage your lists. MailPoet is a sweet plugin maintained and supported with love by a team of a dozen.Version 2.6.16 | By MailPoet | View details
Select Maintenance Page
Maintenance Page
Settings | Deactivate | Edit
Allows you to quickly create a maintenance/coming-soon page. You can use this plugin whenever your site is down for maintenance, currently going any upgrade or is in development. Built in options panel to add logo, background image, social icons, color, subscribe field and many more. Get free support at https://themegrill.com/support-forum/ and check the demo at https://demo.themegrill.com/maintenance-page/Version 1.0.7 | By ThemeGrill | View details
Select OptionTree
OptionTree
Deactivate | Edit
Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes.Version 2.5.5 | By Derek Herman | View details
Select RSS scroller
RSS scroller
Activate | Edit | Delete
This plug-in will display RSS feed with simple scroller or ticker. It gradually reveals each item into view from left to right.Version 6.6 | By Gopi Ramasamy | View details
Select WordPress Importer
WordPress Importer
Activate | Edit | Delete
Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.Version 0.6.1 | By wordpressdotorg | View details
Select WP All Import
WP All Import
Activate | Edit | Delete
The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.Version 3.3.0 | By Soflyy | View details
- The topic ‘Order by in $wp_query Not working’ is closed to new replies.