Is there a better way to access transients using javascript

I've been searching around the web trying to find a better way to use WordPress transients with javascript. Currently I am using admin-Ajax to run a php function that retrieves the transient and returns it. This works fine but I'm curios to know if there is a more effective way of accessing that data without the overhead of using ajax and php.

I know I could probably do this using wp_localize_script() but I'm not sure if that method is any better that my current solution. Hopefully there is an expert out there that can help me with this.

Topic wp-localize-script transient ajax Wordpress javascript

Category Web


Transients should be used for short (for varying definition of it) time caching, and they are by design not reliable. From your description it sound like you are using them in a manner they were not designed to support and therefor probably the "best" for you is to not use transients at all.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.