Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: site_allowed_themes

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

This hook occurs 2 times in this file.

Line Code
1332           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1333                /**
1334                 * Filters the array of themes allowed on the site.
1335                 *
1336                 * @since 4.5.0
1337                 *
1338                 * @param array $allowed_themes An array of theme stylesheet names.
1339                 * @param int   $blog_id        ID of the site. Defaults to current site.
1340                 */
1341                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1342           }
1343
1344           $current = $blog_id == get_current_blog_id();
1345
1346           if ( $current ) {
1347                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1348           } else {
1349                switch_to_blog( $blog_id );
1350                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1382                          switch_to_blog( $blog_id );
1383                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1384                          delete_option( 'allowed_themes' );
1385                          restore_current_blog();
1386                     }
1387                }
1388           }
1389
1390           /** This filter is documented in wp-includes/class-wp-theme.php */
1391           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1392      }
1393
1394      /**
1395       * Enables a theme for all sites on the current network.
1396       *
1397       * @since 4.6.0
1398       * @static
1399       *
1400       * @param string|array $stylesheets Stylesheet name or array of stylesheet names.