-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Description
After upgrading from 2.1.0 to 2.1.1 the order in a Taxonomy-field multiselect is not the same that has been specified on the UI.
We're using the Taxonomy field to show content on the frontend in the same order that the user has chosen on the field.
This works fine in 2.1.0 but not in 2.1.1.
The order is changed from whatever is in that field, to be alphabetical.
Most likely caused by 56aa0f0fce0b74be5b971a0c080493058f26a22f
Adding
return ( new TermObjectConnectionResolver( $root, $args, $context, $info ) )
->set_query_arg( 'orderby', 'include' ) // This one
->get_connection();fixes this.
Steps to reproduce
-
Set up a clean WordPress environment (did this with Local/LocalWP)
-
Install acf, wpgraphql, wpgraphql-acf
-
Import provided ACF Field Group(s).
-
Create 3 new post categories.
-
Add these newly created categories to a post in the "Taxonomy field" - multiselect (in a order that you can remember).
-
Use the following query to query for posts
{
posts {
nodes {
taxonomyTest {
taxonomyTest {
nodes {
name
}
}
}
}
}
}You'll get the categories in a different order than you specified.
2.1.0 returns in the same order as specified on the UI.
PHP or JSON export of the ACF Field Group(s)
[
{
"key": "group_65c65d1cca9d1",
"title": "Taxonomy Test",
"fields": [
{
"key": "field_65c65d1d8c19d",
"label": "Taxonomy Test",
"name": "taxonomy_test",
"aria-label": "",
"type": "taxonomy",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"taxonomy": "category",
"add_term": 0,
"save_terms": 0,
"load_terms": 0,
"return_format": "id",
"field_type": "multi_select",
"allow_null": 0,
"bidirectional": 0,
"show_in_graphql": 1,
"graphql_description": "",
"graphql_field_name": "taxonomyTest",
"multiple": 0,
"bidirectional_target": []
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"show_in_graphql": 1,
"graphql_field_name": "taxonomyTest",
"map_graphql_types_from_location_rules": 0,
"graphql_types": ""
}
]Additional context
No response
WPGraphQL Version
2.1.1
WPGraphQL For ACF Version
1.21.0
ACF (Advanced Custom Fields) Version. Free or Pro?
6.2.6.1 (demo reproduction on Free, bug noticed on Pro)
WordPress Version
6.4.3
PHP Version
8.1.23
Additional enviornment details
Reproduceable on a pure WordPress installation. No additional plugins installed.
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.
- Yes
- My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.