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
1710           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1711                /**
1712                 * Filters the array of themes allowed on the site.
1713                 *
1714                 * @since 4.5.0
1715                 *
1716                 * @param string[] $allowed_themes An array of theme stylesheet names.
1717                 * @param int      $blog_id        ID of the site. Defaults to current site.
1718                 */
1719                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1720           }
1721
1722           $current = get_current_blog_id() === $blog_id;
1723
1724           if ( $current ) {
1725                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1726           } else {
1727                switch_to_blog( $blog_id );
1728                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1763                          switch_to_blog( $blog_id );
1764                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1765                          delete_option( 'allowed_themes' );
1766                          restore_current_blog();
1767                     }
1768                }
1769           }
1770
1771           /** This filter is documented in wp-includes/class-wp-theme.php */
1772           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1773      }
1774
1775      /**
1776       * Returns the folder names of the block template directories.
1777       *
1778       * @since 6.4.0
1779       *
1780       * @return string[] {
1781       *     Folder names used by block themes.