• Resolved sthubbins

    (@sthubbins)


    Hi,

    I have a custom endpoint that I am able to cache using your plugin. When the plugin is active and the response is cached the plugin seems to include post details in the response that are not output when the plugin is deactivated and not caching (post_author, post_date etc).

    Do you know how I can ensure the response remains exactly the same pre and post cache and does not display this post data?

    Thanks!
    Darren

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Acato

    (@acato)

    Hi @sthubbins

    Thank you for using our plugin!

    Our plugin does not add any data to the output (like post_author or post_date). Basically what it does is:

    Check if a cache is available
    – Yes? > Return it.
    – No? > Let WordPress process the request as it would do without our plugin and fetch the results to cache it.

    So the response should be the same in both cases.

    Are you sure you aren’t doing different calls to the API when testing with or without our plugin activated?

    Thread Starter sthubbins

    (@sthubbins)

    Hi Acato,

    Appreciate the response.

    This behaviour was in fact due to code in the theme removing the additional post fields after querying the posts. This function was not running when the plugins cached response was used so the additional fields were then showing.

    Best
    D

    Plugin Author Acato

    (@acato)

    Hi @sthubbins

    Thank you for letting us know. However, I am very curious about that piece of code. Because the way we set up our plugin we wanted it to not have any impact on the normal output. If I understand you correctly a piece of code isn’t executed when our plugin is active, so I would like to investigate it and see if we can implement a fix for it.

    Is it possible for you to share that piece of code?

    marcosfreitas

    (@marcosfreitas)

    Hi, I’m trying to use the plugin but my custom routes are not being cached. I’m not using WordPress default endpoints.
    There is some extra configuration that should I do?
    This is the structure of my class.

    https://gist.github.com/marcosfreitas/027200a9e2e1b28ba93a5b532180d498

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @marcosfreitas

    Thank you for using our plugin!

    You are responding to an already resolved issue, in the future please open a new issue, because your question might otherwise be missed.

    In your example code I am missing the function wprc_add_acf_posts_endpoint. Since you are using that function name, I am assuming you already found our FAQ about adding your own endpoint for caching. That FAQ should be enough to get you started.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Rest API End Point’ is closed to new replies.