This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
|September 27, 2019 at 5:31 pm #4656141|
This is the query:
$testimonials_args = array( 'orderby' => array( 'date' => 'DESC' ), 'post_type' => 'testimonials', 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => $item_count ); $testimonials = new WP_Query( $testimonials_args );
where "testimonials" is a custom post-type.
This is the query explained by $testimonials->request:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts JOIN wp_icl_translations wpml_translations ON wp_posts.ID = wpml_translations.element_id AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type) WHERE 1=1 AND wp_posts.post_type = 'testimonials' AND ((wp_posts.post_status = 'publish')) AND ( ( ( wpml_translations.language_code = 'it' OR 0 ) AND wp_posts.post_type IN ('post','page','attachment','wp_block','wpcf7_contact_form','portfolio','testimonials','spb-section' ) ) OR wp_posts.post_type NOT IN ('post','page','attachment','wp_block','wpcf7_contact_form','portfolio','testimonials','spb-section' ) ) ORDER BY wp_posts.post_title ASC LIMIT 0, 16
As you can see, the query has ordering by post_title instead of post_date.
Thank you in advance
|September 27, 2019 at 10:47 pm #4656817|
Languages: English (English ) Spanish (Español )
Timezone: Europe/Madrid (GMT+02:00)
I think the best way to approach this is to ask you to please recreate a simple example of this in the following sandbox site:
The site has been pre-loaded and configured with WPML modules. Please include you code for the post type in the functions.php of the active theme and then create a simple example that illustrates the problem you are encountering.
Write back with steps on how to see this issue on the sandbox site.
|September 28, 2019 at 1:04 am #4656989|
My issue is resolved now. Thank you!