Hi
I would like to change to ASC order by date in the specific taxonomy archive pages
The current archive pages of all categories and taxonomies are Desc order by date.
If possible, I would like to know how to do it?
Thank you
Hey Koji,
Please refer to a solution posted here
https://wordpress.stackexchange.com/a/39818
If you need further assistance please let us know.
Best regards,
Victoria
Hi, Victoria
Thank you for your support.
I tried it. Unfortunately, it did not work for my site.
However, I found another solution to use plugin “Archive Posts Sort Customize,” it works well.
I tried it again, because this plugin is too old ever though it works well.
Here is my code. It works.
add_action( 'pre_get_posts', 'my_change_sort_order');
function my_change_sort_order($query){
if(is_tax( 'your taxonomy name' ) && ! is_tax( 'your taxonomy name', 'exclude slug name' ) ):
//Change "your taxonomy name" and "exclude slug name"
//Set the order ASC or DESC
$query->set( 'order', 'ASC' );
//Set the orderby
$query->set( 'orderby', 'date' );
endif;
};
Thank you again
Koji
Hi Koji,
Glad you got it working for you and thank you for sharing your solution! :)
If you need further assistance please let us know.
Best regards,
Victoria