Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#51478 closed defect (bug) (invalid)

Rest api /pages endpoint returning old version of page when _fields is present in the rest query

Reported by: roquec's profile roquec Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: Cc:

Description

Hi,

when retrieving a page with the rest API I'm using the following rest request:

https://mysite/wp-json/wp/v2/pages?slug=slug-of-the-page&_fields=content,status,title,slug,id

In the response, in the rendered content field, the wrong revision of the page is inside (maybe the first revision?).

But when using the following rest request (the same but without filtering the fields):

https://mysite/wp-json/wp/v2/pages?slug=slug-of-the-page

Then the last revision (the expected one) of the page is returned.

Regards

Change History (3)

#1 @TimothyBlynJacobs
3 years ago

  • Keywords reporter-feedback added

Hi @roquec,

Thanks for your ticket and welcome to trac! Have you verified this on a WordPress site with a stock WordPress Theme, no Plugins, and all forms of caching disabled?

It sounds like something is caching the response.

#2 @roquec
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Hi there,

thank you for your attention. I request apologies for opening this ticket because I have found that there is no problem in the core of WP.

As you correctly said, there was a plugin (Relevanssi) that was manipulating the search query somehow.

I'm sorry.

Thank you for your attention.

#3 @desrosj
3 years ago

  • Focuses rest-api removed
  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Version 5.5.1 deleted
Note: See TracTickets for help on using tickets.