Title: Uncached functions
Author: WordPress VIP Documentation
Published: September 11, 2020
Last modified: September 23, 2025

---

 1. [Caching](https://docs.wpvip.com/caching/)
 2. Uncached functions

#  Uncached functions

For various reasons, some functions in WordPress Core are purposely uncached. Because
of this, calling those uncached functions in application code will always result
in an SQL query. This can have performance implications for a site, particularly
if an uncached function is called by code during a high traffic event. A large volume
of direct SQL queries can overload the primary database and lead to an increase 
in responses with a `503` HTTP status code.

## Cached VIP alternative functions

To prevent issues caused by uncached functions, VIP MU plugins provides several 
alternative versions of functions that will be cached when called on the VIP Platform.

Use `[wpcom_vip_attachment_url_to_postid()](https://github.com/Automattic/vip-go-mu-plugins/blob/0dac75bb599d4b321f073f94b0ea64950b766aad/vip-helpers/vip-caching.php#L608)`
as the cached VIP alternative to:

 * `[attachment_url_to_postid()](https://developer.wordpress.org/reference/functions/attachment_url_to_postid/)`

Use `[wpcom_vip_count_user_posts()](https://github.com/Automattic/vip-go-mu-plugins/blob/0dac75bb599d4b321f073f94b0ea64950b766aad/vip-helpers/vip-caching.php#L369)`
as the cached VIP alternative to:

 * `[count_user_posts()](https://developer.wordpress.org/reference/functions/count_user_posts/)`

Use `[wpcom_vip_get_adjacent_post()](https://github.com/Automattic/vip-go-mu-plugins/blob/0dac75bb599d4b321f073f94b0ea64950b766aad/vip-helpers/vip-caching.php#L509)`
as the cached VIP alternative to:

 * `[get_adjacent_post()](https://developer.wordpress.org/reference/functions/get_adjacent_post/)`
 * `[get_previous_post()](https://developer.wordpress.org/reference/functions/get_previous_post/)`
 * `[get_next_post()](https://developer.wordpress.org/reference/functions/get_next_post/)`
 * `[previous_post_link()](https://developer.wordpress.org/reference/functions/previous_post_link/)`
 * `[next_post_link()](https://developer.wordpress.org/reference/functions/next_post_link/)`

Use `[wpcom_vip_wp_oembed_get()](https://github.com/Automattic/vip-go-mu-plugins/blob/d001993305ebf9d8551da43701029861d2f7c1db/vip-helpers/vip-utils.php#L1045)`
as the cached VIP alternative to:

 * `[wp_oembed_get()](https://developer.wordpress.org/reference/functions/wp_oembed_get/)`

Use `[wpcom_vip_url_to_postid()](https://github.com/Automattic/vip-go-mu-plugins/blob/0dac75bb599d4b321f073f94b0ea64950b766aad/vip-helpers/vip-caching.php#L262)`
as the cached VIP alternative to:

 * `[url_to_postid()](https://developer.wordpress.org/reference/functions/url_to_postid/)`

Use `[wpcom_vip_old_slug_redirect()](https://github.com/Automattic/vip-go-mu-plugins/blob/0dac75bb599d4b321f073f94b0ea64950b766aad/vip-helpers/vip-caching.php#L290)`
as the cached VIP alternative to:

 * `[wp_old_slug_redirect()](https://developer.wordpress.org/reference/functions/wp_old_slug_redirect/)`

Last updated: September 23, 2025