We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to query my custom post type over the WP REST API with the cache plugin enabled.
On first call, or without cache, it renders the following correct JSON output:
[{ "id": 4220, "date": "2016-11-18T15:03:52", "date_gmt": "2016-11-18T14:03:52", "guid": { "rendered": "https:\/\/www.studioimnetz.de\/?post_type=bswp_paedi_winners&p=4220" }, "modified": "2017-08-13T17:57:21", "modified_gmt": "2017-08-13T15:57:21", "slug": "mrwissen2go", "status": "publish", "type": "bswp_paedi_winners", "link": "http:\/\/localhost\/wordpress_40\/paedi-winners\/mrwissen2go\/", "title": { "rendered": "MrWissen2go" }, "content": { "rendered": "", "protected": false }, "author": 1, "featured_media": 0, "template": "", "meta": [], "platforms": [2], "_links": { "self": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220" }], "collection": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners" }], "about": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/types\/bswp_paedi_winners" }], "author": [{ "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" }], "version-history": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220\/revisions" }], "wp:attachment": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/media?parent=4220" }], "wp:term": [{ "taxonomy": "platform", "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms?post=4220" }], "curies": [{ "name": "wp", "href": "https:\/\/api.w.org\/{rel}", "templated": true }] }, "_embedded": { "author": [{ "id": 1, "name": "benjamin.jentsch", "url": "", "description": "", "link": "http:\/\/localhost\/wordpress_40\/author\/benjamin-jentsch\/", "slug": "benjamin-jentsch", "avatar_urls": { "24": "http:\/\/2.gravatar.com\/avatar\/83bdd363b7932e80b3e1a8d989dc3238?s=24&d=mm&r=g", "48": "http:\/\/2.gravatar.com\/avatar\/83bdd363b7932e80b3e1a8d989dc3238?s=48&d=mm&r=g", "96": "http:\/\/2.gravatar.com\/avatar\/83bdd363b7932e80b3e1a8d989dc3238?s=96&d=mm&r=g" }, "_links": { "self": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" }], "collection": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users" }] } }], "wp:term": [ [{ "id": 2, "link": "http:\/\/localhost\/wordpress_40\/platform\/web\/", "name": "Web", "slug": "web", "taxonomy": "platform", "_links": { "self": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms\/2" }], "collection": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms" }], "about": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/taxonomies\/platform" }], "wp:post_type": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners?platforms=2" }], "curies": [{ "name": "wp", "href": "https:\/\/api.w.org\/{rel}", "templated": true }] } }] ] } }]
However, when the cache delivers the cached version from the database, the result is as follows:
[{ "id": 4220, "date": "2016-11-18T15:03:52", "date_gmt": "2016-11-18T14:03:52", "guid": { "rendered": "https:\/\/www.studioimnetz.de\/?post_type=bswp_paedi_winners&p=4220" }, "modified": "2017-08-13T17:57:21", "modified_gmt": "2017-08-13T15:57:21", "slug": "mrwissen2go", "status": "publish", "type": "bswp_paedi_winners", "link": "http:\/\/localhost\/wordpress_40\/paedi-winners\/mrwissen2go\/", "title": { "rendered": "MrWissen2go" }, "content": { "rendered": "", "protected": false }, "author": 1, "featured_media": 0, "template": "", "meta": [], "platforms": [2], "_links": { "self": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220" }], "collection": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners" }], "about": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/types\/bswp_paedi_winners" }], "author": [{ "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" }], "version-history": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220\/revisions" }], "wp:attachment": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/media?parent=4220" }], "wp:term": [{ "taxonomy": "platform", "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms?post=4220" }], "curies": [{ "name": "wp", "href": "https:\/\/api.w.org\/{rel}", "templated": true }] }, "_embedded": { "author": [ [{ "id": 4220, "date": "2016-11-18T15:03:52", "date_gmt": "2016-11-18T14:03:52", "guid": { "rendered": "https:\/\/www.studioimnetz.de\/?post_type=bswp_paedi_winners&p=4220" }, "modified": "2017-08-13T17:57:21", "modified_gmt": "2017-08-13T15:57:21", "slug": "mrwissen2go", "status": "publish", "type": "bswp_paedi_winners", "link": "http:\/\/localhost\/wordpress_40\/paedi-winners\/mrwissen2go\/", "title": { "rendered": "MrWissen2go" }, "content": { "rendered": "", "protected": false }, "author": 1, "featured_media": 0, "template": "", "meta": [], "platforms": [2], "_links": { "self": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220" }], "collection": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners" }], "about": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/types\/bswp_paedi_winners" }], "author": [{ "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" }], "version-history": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220\/revisions" }], "wp:attachment": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/media?parent=4220" }], "wp:term": [{ "taxonomy": "platform", "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms?post=4220" }], "curies": [{ "name": "wp", "href": "https:\/\/api.w.org\/{rel}", "templated": true }] } }] ], "wp:term": [ [{ "id": 4220, "date": "2016-11-18T15:03:52", "date_gmt": "2016-11-18T14:03:52", "guid": { "rendered": "https:\/\/www.studioimnetz.de\/?post_type=bswp_paedi_winners&p=4220" }, "modified": "2017-08-13T17:57:21", "modified_gmt": "2017-08-13T15:57:21", "slug": "mrwissen2go", "status": "publish", "type": "bswp_paedi_winners", "link": "http:\/\/localhost\/wordpress_40\/paedi-winners\/mrwissen2go\/", "title": { "rendered": "MrWissen2go" }, "content": { "rendered": "", "protected": false }, "author": 1, "featured_media": 0, "template": "", "meta": [], "platforms": [2], "_links": { "self": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220" }], "collection": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners" }], "about": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/types\/bswp_paedi_winners" }], "author": [{ "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" }], "version-history": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220\/revisions" }], "wp:attachment": [{ "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/media?parent=4220" }], "wp:term": [{ "taxonomy": "platform", "embeddable": true, "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms?post=4220" }], "curies": [{ "name": "wp", "href": "https:\/\/api.w.org\/{rel}", "templated": true }] } }] ] } }]
So the diff would be:
--- paedi_winners.json Tue Aug 15 16:11:58 2017 +++ paedi_winners_cached.json Tue Aug 15 16:11:58 2017 @@ -55,46 +55,115 @@ }] }, "_embedded": { - "author": [{ - "id": 1, - "name": "benjamin.jentsch", - "url": "", - "description": "", - "link": "http:\/\/localhost\/wordpress_40\/author\/benjamin-jentsch\/", - "slug": "benjamin-jentsch", - "avatar_urls": { - "24": "http:\/\/2.gravatar.com\/avatar\/83bdd363b7932e80b3e1a8d989dc3238?s=24&d=mm&r=g", - "48": "http:\/\/2.gravatar.com\/avatar\/83bdd363b7932e80b3e1a8d989dc3238?s=48&d=mm&r=g", - "96": "http:\/\/2.gravatar.com\/avatar\/83bdd363b7932e80b3e1a8d989dc3238?s=96&d=mm&r=g" - }, - "_links": { - "self": [{ - "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" - }], - "collection": [{ - "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users" - }] - } - }], + "author": [ + [{ + "id": 4220, + "date": "2016-11-18T15:03:52", + "date_gmt": "2016-11-18T14:03:52", + "guid": { + "rendered": "https:\/\/www.studioimnetz.de\/?post_type=bswp_paedi_winners&p=4220" + }, + "modified": "2017-08-13T17:57:21", + "modified_gmt": "2017-08-13T15:57:21", + "slug": "mrwissen2go", + "status": "publish", + "type": "bswp_paedi_winners", + "link": "http:\/\/localhost\/wordpress_40\/paedi-winners\/mrwissen2go\/", + "title": { + "rendered": "MrWissen2go" + }, + "content": { + "rendered": "", + "protected": false + }, + "author": 1, + "featured_media": 0, + "template": "", + "meta": [], + "platforms": [2], + "_links": { + "self": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220" + }], + "collection": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners" + }], + "about": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/types\/bswp_paedi_winners" + }], + "author": [{ + "embeddable": true, + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" + }], + "version-history": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220\/revisions" + }], + "wp:attachment": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/media?parent=4220" + }], + "wp:term": [{ + "taxonomy": "platform", + "embeddable": true, + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms?post=4220" + }], + "curies": [{ + "name": "wp", + "href": "https:\/\/api.w.org\/{rel}", + "templated": true + }] + } + }] + ], "wp:term": [ [{ - "id": 2, - "link": "http:\/\/localhost\/wordpress_40\/platform\/web\/", - "name": "Web", - "slug": "web", - "taxonomy": "platform", + "id": 4220, + "date": "2016-11-18T15:03:52", + "date_gmt": "2016-11-18T14:03:52", + "guid": { + "rendered": "https:\/\/www.studioimnetz.de\/?post_type=bswp_paedi_winners&p=4220" + }, + "modified": "2017-08-13T17:57:21", + "modified_gmt": "2017-08-13T15:57:21", + "slug": "mrwissen2go", + "status": "publish", + "type": "bswp_paedi_winners", + "link": "http:\/\/localhost\/wordpress_40\/paedi-winners\/mrwissen2go\/", + "title": { + "rendered": "MrWissen2go" + }, + "content": { + "rendered": "", + "protected": false + }, + "author": 1, + "featured_media": 0, + "template": "", + "meta": [], + "platforms": [2], "_links": { "self": [{ - "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms\/2" + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220" }], "collection": [{ - "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms" + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners" }], "about": [{ - "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/taxonomies\/platform" + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/types\/bswp_paedi_winners" }], - "wp:post_type": [{ - "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners?platforms=2" + "author": [{ + "embeddable": true, + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/users\/1" + }], + "version-history": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/paedi_winners\/4220\/revisions" + }], + "wp:attachment": [{ + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/media?parent=4220" + }], + "wp:term": [{ + "taxonomy": "platform", + "embeddable": true, + "href": "http:\/\/localhost\/wordpress_40\/wp-json\/wp\/v2\/platforms?post=4220" }], "curies": [{ "name": "wp",
As you can see, the author and wp:term fields get replaced with the custom post type's content, which is not exactly what I want.
author
wp:term
I'm not quite sure if this is a WP REST API Cache bug or a wordpress API core bug.
The text was updated successfully, but these errors were encountered:
Hi @bjentsch, Please, follow here: #9 Thanks
Sorry, something went wrong.
Wow, didn't connect these two when looking through the issues. Sorry mate.
@bjentsch please follow the other issue. Thanks for your help.
No branches or pull requests
I'm trying to query my custom post type over the WP REST API with the cache plugin enabled.
On first call, or without cache, it renders the following correct JSON output:
However, when the cache delivers the cached version from the database, the result is as follows:
So the diff would be:
As you can see, the
author
andwp:term
fields get replaced with the custom post type's content, which is not exactly what I want.I'm not quite sure if this is a WP REST API Cache bug or a wordpress API core bug.
The text was updated successfully, but these errors were encountered: