Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @telsenome

    I just did a test and published a post. I then requested it through the WP REST API and it was cached. Next I switched it to draft and the cache was flushed.

    So to me it seems this works perfectly fine?

    Thread Starter telsenome

    (@telsenome)

    How strange. I tested now and it doesn’t work for me. Could it be related to fetching posts via categories? For example, here’s a request URI that isn’t flushed when switching a post from published to draft.

    /blog/wp-json/wp/v2/posts?_embed=wp:featuredmedia&_fields=id,date,modified,slug,title,excerpt,author,categories,_links,_embedded&categories=121&orderby=date&page=1&per_page=9

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @telsenome

    No this isn’t related to fetching posts via categories. It is related to the _fields parameter you are using. Our plugin needs one extra field in this list: type. It is used to determine the correct object type from the REST results, without this object type it doesn’t know when to flush it.

    Thread Starter telsenome

    (@telsenome)

    So if I add

    /blog/wp-json/wp/v2/posts?_embed=wp:featuredmedia&_fields=type,id,date,modified,slug,title,excerpt,author,categories,_links,_embedded&categories=121&orderby=date&page=1&per_page=9

    then it will work?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘It seems like the cache doesn’t flush when a post is switched to draft’ is closed to new replies.