get_current_blog_id() on advanced-cache.php
-
Hi,
As the title says, I am creating an advanced-cache.php drop-in and I would like to detect the current blog id with
get_current_blog_id(), which will always return1because it’s to early.I see that
is_multisite()works, but this doesn’t tell me which one is it.
So I was wondering, if I can perhaps include a few files and detect which blog ID am I running based on the url?I also see that
require_wp_db()can be used to connect to the database earlier, but how do I find the current blog id from advanced-cache.phpOr is it possible to perhaps define a constant after
is_multisite()and then postpone serving a cache file until later?Where is the earliest hook I can get the current site id, send the cache file and end execution? Any example or snippet to print the site id as string and end execution right there without loading anything else?
Thank you
The topic ‘get_current_blog_id() on advanced-cache.php’ is closed to new replies.