Make WordPress Core

Opened 10 years ago

Closed 10 months ago

Last modified 8 months ago

#35907 closed enhancement (fixed)

Permit sticky posts to affect the query in REST_REQUEST

Reported by: danielbachhuber's profile danielbachhuber Owned by: rmccue's profile rmccue
Milestone: 6.8 Priority: high
Severity: normal Version:
Component: Query Keywords: gutenberg-merge has-patch has-unit-tests
Focuses: Cc:

Attachments (1)

35907.1.diff (722 bytes) - added by danielbachhuber 10 years ago.

Download all attachments as: .zip

Change History (27)

#1 @danielbachhuber
10 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by jorbin. View the logs.


10 years ago

#3 @rmccue
10 years ago

  • Owner set to rmccue
  • Status changed from new to reviewing

This ticket was mentioned in Slack in #core by mike. View the logs.


10 years ago

#5 @jorbin
10 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 36696:

Permit sticky posts to affect the query in REST_REQUEST

Needed for https://github.com/WP-API/WP-API/issues/2210

Props danielbachhuber.
Fixes #35907.

#6 @jorbin
10 years ago

In 36699:

Revert r36696

This broke embeds. Needs a better solution to also make sure all queries from the REST API aren't broken.

see #35907.

#7 @jorbin
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#8 @jorbin
10 years ago

  • Milestone changed from 4.5 to Future Release

This ticket was mentioned in Slack in #core-restapi by krogsgard. View the logs.


9 years ago

#10 @johnbillion
9 years ago

In 40545:

REST API: Remove a useless unit test.

See #35907, #38373

#11 @johnbillion
9 years ago

  • Keywords needs-unit-tests added

#12 @Mamaduka
11 months ago

I think this was fixed by #50213.

The fix should be applied to this condition in WP_REST_Posts_Controller for it to work. The isset( $query_args['ignore_sticky_posts'] ) is always false unless the value is filtered.

https://github.com/WordPress/wordpress-develop/blob/21be4bc5f1e5af7c96c25d13315a9bf578b4aea7/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L1197-L1199

Fixing this will make Query block results consistent between the editor and front-end. See:

@joemcgill, @desrosj, can we move this to WP 6.8 milestone?

#13 @audrasjb
11 months ago

  • Milestone changed from Future Release to 6.8
  • Priority changed from normal to high

Moving to milestone 6.8 with high priority as asked by @Mamaduka as it is a blocker for some bugfixes on the Editor side.

This ticket was mentioned in PR #8228 on WordPress/wordpress-develop by @Mamaduka.


11 months ago
#14

  • Keywords has-unit-tests added; needs-unit-tests removed

#15 @Mamaduka
10 months ago

  • Keywords gutenberg-merge added

@peterwilsoncc commented on PR #8228:


10 months ago
#16

Let's put it in with true for ignoring the stickies.

My one last naming things question is whether it should be plural ignore_stickies

@Mamaduka commented on PR #8228:


10 months ago
#17

Let's put it in with true for ignoring the stickies.

So, merge as it is. Send ' true ' if the user doesn't want sticky posts to stick.

My one last naming things question is whether it should be plural ignore_stickies

Don't have a strong opinion here, but there's not much difference between ignore_stickies and ignore_sticky. The latter is closer to the WP_Query argument, so it is probably easier to remember.

@peterwilsoncc commented on PR #8228:


10 months ago
#18

My one last naming things question is whether it should be plural ignore_stickies

Don't have a strong opinion here, but there's not much difference between ignore_stickies and ignore_sticky. The latter is closer to the WP_Query argument, so it is probably easier to remember.

My thought (bike shedding??) is that the current name is singular whereas the WP_Query is plural with the _posts. The reason for my suggestion is that multiple posts made be ignored.

But the rest api has stickymaybe the opportunity has been missed and I should stop over thinking it :)

@Mamaduka commented on PR #8228:


10 months ago
#19

But the rest api has sticky maybe the opportunity has been missed

Considering the existing argument, I'm leaning towards ignore_sticky.

@peterwilsoncc commented on PR #8228:


10 months ago
#20

Dancer, works for me!

https://github.com/user-attachments/assets/1f1b9682-3cb3-460a-ba9c-6d02b778235c

#21 @peterwilsoncc
10 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 59801:

REST API: Add support for the ignore_sticky_posts argument.

Introduce ignore_sticky as a boolean argument for the posts endpoint for requests without the sticky posts being stuck. The new argument defaults to false with the value of the argument passed to WP_Query's ignore_sticky_posts parameter.

Props audrasjb, danielbachhuber, joemcgill, johnbillion, jorbin, mamaduka, rmccue.
Fixes #35907.

@Mamaduka commented on PR #8228:


10 months ago
#22

Thanks, @peterwilsoncc!

#23 @wildworks
8 months ago

It seems that this [59081] caused a problem. See #63339.

#24 @SirLouen
8 months ago

More affected #63307

#25 @jorbin
8 months ago

In 60197:

REST API: Change posts endpoint to ignore_sticky=true by default

This restores the 6.7 and below behavior for the posts endpoint which did not include sticky posts by default.

Follow-up to [59801].

Props nikunj8866, SirLouen, ankitmaru, wildworks, karthikeya01, Mamaduka, spacedmonkey, jorbin.
Fixes #63307. See #35907.

#26 @jorbin
8 months ago

In 60200:

REST API: Change posts endpoint to ignore_sticky=true by default

This restores the 6.7 and below behavior for the posts endpoint which did not include sticky posts by default.

Follow-up to [59801].

Reviewed by desrosj.
Merges [60197] to the 6.8 branch.

Props nikunj8866, SirLouen, ankitmaru, wildworks, karthikeya01, Mamaduka, spacedmonkey, jorbin.
Fixes #63307. See #35907.

Note: See TracTickets for help on using tickets.