WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.19k forks source link

Query block doesn't display sticky posts when inheriting from template #44471

Closed jameskoster closed 1 week ago

jameskoster commented 2 years ago

Description

Here's my home page on the frontend:

Screenshot 2022-09-26 at 17 50 49

Note the sticky post. It doesn't appear in the Query loop in the Site Editor:

Screenshot 2022-09-26 at 17 51 11

Step-by-step reproduction instructions

  1. Make a post sticky
  2. Ensure your home page is set to display latest posts
  3. Open the site editor
  4. Observe the missing sticky post

Expected behaviour

I expected the sticky post to appear.

annezazu commented 2 years ago

@jameskoster does this occur with 6.1 beta 1? Wondering if we need to add it to the project board.

jameskoster commented 2 years ago

does this occur with 6.1 beta 1?

Yup, same experience on 6.1 beta 1.

tellthemachines commented 2 years ago

Was this ever working before? A quick test shows it doesn't work in 6.0.2.

jameskoster commented 2 years ago

I'd never checked until now, so I don't know. I'm surprised it never came up 🤔

Mamaduka commented 2 years ago

I think this is a Core REST API issue.

The current solution for sticky posts is to not give them special treatment by default, but to provide a ?sticky= parameter to explicitly exclude them or to return only stickies, added in https://github.com/WP-API/WP-API/pull/2708.

Source: https://github.com/WP-API/WP-API/issues/2764

Trac ticket: https://core.trac.wordpress.org/ticket/35907

cbravobernal commented 2 years ago

Removing this issue from the 6.1 dashboard.

AllTerrainDeveloper commented 1 year ago

I can't replicate the issue, using latest version up to today.

  1. I've created a bunch of new posts.
  2. I've checked that all of them are showing in the main page (even there is a button to show "older posts")
  3. I've went ahead and edited one of the first post that were shown when viewing "older posts"
  4. I've checked the sticky post option
  5. I've updated the post
  6. I've checked that the post was the first one in the latest posts.
tellthemachines commented 1 year ago

@AllTerrainDeveloper are you looking in the front end? This issue is only reproducible within the Query block in the site editor.

AllTerrainDeveloper commented 1 year ago

Oops! You are right, I didn't test it in the proper way!

richtabor commented 3 months ago

I think this is a Core REST API issue.

@Mamaduka is there a path forward for this? There are a few efforts to clean up the Query Loop block and this is one that sticks out as a missed expectation when using sticky posts.

Mamaduka commented 3 months ago

@richtabor, there's been no updates for the REST API issue, which is the current blocker here.

ntsekouras commented 1 week ago

Should we close this one as is a core issue and tracked here: https://core.trac.wordpress.org/ticket/35907?

Mamaduka commented 1 week ago

@ntsekouras, yes. I think we can close the issue here. It's not actionable on the editor side and needs a REST API fix.