Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_cache_themes_persistently

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
342      // We always want to return absolute, but we need to cache relative
343      // to use in get_theme_root().
344      foreach ( $wp_theme_directories as $theme_root ) {
345           if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
346                $relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root;
347           else
348                $relative_theme_roots[ $theme_root ] = $theme_root;
349      }
350
351      if ( $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ) ) {
352           $cached_roots = get_site_transient( 'theme_roots' );
353           if ( is_array( $cached_roots ) ) {
354                foreach ( $cached_roots as $theme_dir => $theme_root ) {
355                     // A cached theme root is no longer around, so skip it.
356                     if ( ! isset( $relative_theme_roots[ $theme_root ] ) )
357                          continue;
358                     $found_themes[ $theme_dir ] = array(
359                          'theme_file' => $theme_dir . '/style.css',
360                          'theme_root' => $relative_theme_roots[ $theme_root ], // Convert relative to absolute.