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
1501           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1502                /**
1503                 * Filters the array of themes allowed on the site.
1504                 *
1505                 * @since 4.5.0
1506                 *
1507                 * @param string[] $allowed_themes An array of theme stylesheet names.
1508                 * @param int      $blog_id        ID of the site. Defaults to current site.
1509                 */
1510                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1511           }
1512
1513           $current = get_current_blog_id() == $blog_id;
1514
1515           if ( $current ) {
1516                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1517           } else {
1518                switch_to_blog( $blog_id );
1519                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1552                          switch_to_blog( $blog_id );
1553                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1554                          delete_option( 'allowed_themes' );
1555                          restore_current_blog();
1556                     }
1557                }
1558           }
1559
1560           /** This filter is documented in wp-includes/class-wp-theme.php */
1561           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1562      }
1563
1564      /**
1565       * Enables a theme for all sites on the current network.
1566       *
1567       * @since 4.6.0
1568       *
1569       * @param string|string[] $stylesheets Stylesheet name or array of stylesheet names.
1570       */