Title: trigger do_shortcode on cached request
Last modified: August 19, 2022

---

# trigger do_shortcode on cached request

 *  Resolved [mdxclr](https://wordpress.org/support/users/mdxclr/)
 * (@mdxclr)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/)
 * Hi,
    I want to make some part of content dynamic, using do_shortcode (for replacing
   currency and change amount based on rates). Tried `rest_pre_echo_response` with
   priority 10 and 9999 (looks like plugin in `get_api_cache` using 1000 priority),
   but still getting shortcode in a raw.
 * Or maybe there is better solution how to do this?
    I’m sending currency as header,
   list of currencies and rates provided in php files.
    -  This topic was modified 3 years, 9 months ago by [mdxclr](https://wordpress.org/support/users/mdxclr/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [mdxclr](https://wordpress.org/support/users/mdxclr/)
 * (@mdxclr)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15931780)
 * Okay, as I understand this filter is skipped and content is returned from `get_cache`
   function – is there a way how can I filter its content?
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15932147)
 * Hi [@mdxclr](https://wordpress.org/support/users/mdxclr/)
 * If a cache record is present for the current request, it is returned and none
   of the filters you mentioned are triggered. At this point there isn’t a filter
   available to filter the cached data, however I think I do understand your use
   case. I think we can add a filter you could use, however I will have to discuss
   this with my colleagues first. I will see if we can add such a filter next week
   and will get back to you!
 * By the way: because of the way our plugin works (if a cache is present no (normal)
   plugins are executed) you would have to use this filter from a mu-plugin which
   is alphabetically before `wp-rest-cache.php`
 *  Thread Starter [mdxclr](https://wordpress.org/support/users/mdxclr/)
 * (@mdxclr)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15932639)
 * That would be great, if you can add the filter, because filtering it throw get_transient_*
   is very hard.
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15950064)
 * [@mdxclr](https://wordpress.org/support/users/mdxclr/) We just released a new
   version of our plugin which includes a new filter `wp_rest_cache/filter_cache_output`
   which can be used from a must use plugin that is loaded before our must use plugin(
   so alphabetically before wp-rest-cache.php).
 *  Thread Starter [mdxclr](https://wordpress.org/support/users/mdxclr/)
 * (@mdxclr)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15979973)
 * Can you also please add to filter some data about request? Request URI or callback
   function name for example
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15991669)
 * [@mdxclr](https://wordpress.org/support/users/mdxclr/) Isn’t the Request URI 
   something you can get from `$_SERVER['REQUEST_URI']`? What would it add if we
   added it to the filter?

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘trigger do_shortcode on cached request’ is closed to new replies.

 * ![](https://ps.w.org/wp-rest-cache/assets/icon-256x256.png?rev=3328849)
 * [WP REST Cache](https://wordpress.org/plugins/wp-rest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-rest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-rest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-rest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-rest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-rest-cache/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/trigger-do_shortcode-on-cached-request/#post-15991669)
 * Status: resolved