From 8b8e709cd77f9aa03f8a4583c4381fbf88b39f44 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Sat, 2 Mar 2024 11:51:38 +1100 Subject: [PATCH] Prime the cache later on the init hook. --- inc/namespace.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/namespace.php b/inc/namespace.php index 07cafc5..ed561bb 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -15,8 +15,14 @@ */ function bootstrap() { add_filter( 'font_dir', __NAMESPACE__ . '\\filter_default_font_directory' ); - // Prime the cache. - add_action( 'init', __NAMESPACE__ . '\\cached_wp_get_upload_dir' ); + + /* + * Prime the uploads cache hook. + * + * This runs late on the `init` hook to allow time for plugins to register + * custom upload directory file handlers. + */ + add_action( 'init', __NAMESPACE__ . '\\cached_wp_get_upload_dir', 20 ); } /**