wp-graphql / wp-graphql

:rocket: GraphQL API for WordPress

Home Page:https://www.wpgraphql.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sticky posts are ignored

PSMJonas opened this issue · comments

Description

When I mark a post as sticky, it is not output first in the query.

I read in another issue that by default $query_args['ignore_sticky_posts'] is set to true.

https://github.com/wp-graphql/wp-graphql/blob/develop/src/Data/Connection/PostObjectConnectionResolver.php#L178

I have disabled this:

add_filter('graphql_post_object_connection_query_args', function($query_args, $source, $input) {
    $query_args['ignore_sticky_posts'] = false;
    return $query_args;
}, 10, 3);

Unfortunately this did not change anything.

Steps to reproduce

  1. mark a post as sticky.
  2. Output a query with posts.
  3. The sticky post is not output at the top.

Additional context

No response

WPGraphQL Version

0.12.2

WordPress Version

6.3.2

PHP Version

8.1

Additional environment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.

related #863
related #786

I saw that, but there doesn't seem to be a solution currently.

Confirming this as a duplicate of #786 and closing.

@PSMJonas while the PR above is out of date, the cause and proposed solve in the issue are still relevant. If you have any feedback on what's been proposed in #786, please feel free to share it as a comment over there 😎