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
1613           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1614                /**
1615                 * Filters the array of themes allowed on the site.
1616                 *
1617                 * @since 4.5.0
1618                 *
1619                 * @param string[] $allowed_themes An array of theme stylesheet names.
1620                 * @param int      $blog_id        ID of the site. Defaults to current site.
1621                 */
1622                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1623           }
1624
1625           $current = get_current_blog_id() == $blog_id;
1626
1627           if ( $current ) {
1628                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1629           } else {
1630                switch_to_blog( $blog_id );
1631                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1664                          switch_to_blog( $blog_id );
1665                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1666                          delete_option( 'allowed_themes' );
1667                          restore_current_blog();
1668                     }
1669                }
1670           }
1671
1672           /** This filter is documented in wp-includes/class-wp-theme.php */
1673           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1674      }
1675
1676      /**
1677       * Enables a theme for all sites on the current network.
1678       *
1679       * @since 4.6.0
1680       *
1681       * @param string|string[] $stylesheets Stylesheet name or array of stylesheet names.
1682       */