WordPress.org

Make WordPress Core

Opened 3 weeks ago

Closed 5 days 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 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.5.1
Component: REST API Keywords: reporter-feedback
Focuses: rest-api 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 (2)

#1 @TimothyBlynJacobs
7 days 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
5 days 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.

Note: See TracTickets for help on using tickets.