johnbillion / extended-cpts

A library which provides extended functionality to WordPress custom post types and taxonomies.
GNU General Public License v2.0
980 stars 96 forks source link

Sorting not working on single tem page #207

Open Malin88 opened 2 years ago

Malin88 commented 2 years ago

Hi, I have CPT called team with taxonomy profession. Then, I added an ACF field sorting_name that I wanted to sort by, and the last step I added:

'site_sortables' => ['sorting_name' => array(
                'meta_key' => 'sorting_name',
                'default' => 'ASC',
            )],

On main archive page /team new sorting works fine, but when I go to any category of 'profession' eg. /profession/office the list of posts is sorting by title as it was before.

any suggestions how to fix this ?

johnbillion commented 2 years ago

Thanks for the report. Off the top of my head I'm pretty sure that sorting only applies to the main post type archive, not a term archive for the post type. Technically the term archive could include other post types.

It makes sense for this to apply to term archives too, though. Unfortunately I don't have any time to implement this at the moment nor any time soon, but PRs are welcome.