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
1324           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1325                /**
1326                 * Filters the array of themes allowed on the site.
1327                 *
1328                 * @since 4.5.0
1329                 *
1330                 * @param array $allowed_themes An array of theme stylesheet names.
1331                 * @param int   $blog_id        ID of the site. Defaults to current site.
1332                 */
1333                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1334           }
1335
1336           $current = $blog_id == get_current_blog_id();
1337
1338           if ( $current ) {
1339                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1340           } else {
1341                switch_to_blog( $blog_id );
1342                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1374                          switch_to_blog( $blog_id );
1375                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1376                          delete_option( 'allowed_themes' );
1377                          restore_current_blog();
1378                     }
1379                }
1380           }
1381
1382           /** This filter is documented in wp-includes/class-wp-theme.php */
1383           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1384      }
1385
1386      /**
1387       * Enables a theme for all sites on the current network.
1388       *
1389       * @since 4.6.0
1390       * @static
1391       *
1392       * @param string|array $stylesheets Stylesheet name or array of stylesheet names.