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
1346           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1347                /**
1348                 * Filters the array of themes allowed on the site.
1349                 *
1350                 * @since 4.5.0
1351                 *
1352                 * @param array $allowed_themes An array of theme stylesheet names.
1353                 * @param int   $blog_id        ID of the site. Defaults to current site.
1354                 */
1355                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1356           }
1357
1358           $current = $blog_id == get_current_blog_id();
1359
1360           if ( $current ) {
1361                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1362           } else {
1363                switch_to_blog( $blog_id );
1364                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1396                          switch_to_blog( $blog_id );
1397                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1398                          delete_option( 'allowed_themes' );
1399                          restore_current_blog();
1400                     }
1401                }
1402           }
1403
1404           /** This filter is documented in wp-includes/class-wp-theme.php */
1405           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1406      }
1407
1408      /**
1409       * Enables a theme for all sites on the current network.
1410       *
1411       * @since 4.6.0
1412       * @access public
1413       * @static
1414       *