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
1256           if ( isset( $allowed_themes[ $blog_id ] ) ) {
1257                /**
1258                 * Filter the array of themes allowed on the site.
1259                 *
1260                 * @since 4.5.0
1261                 *
1262                 * @param array $allowed_themes An array of theme stylesheet names.
1263                 * @param int   $blog_id        ID of the site. Defaults to current site.
1264                 */
1265                return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1266           }
1267
1268           $current = $blog_id == get_current_blog_id();
1269
1270           if ( $current ) {
1271                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1272           } else {
1273                switch_to_blog( $blog_id );
1274                $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
 
Line Code
1306                          switch_to_blog( $blog_id );
1307                          update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1308                          delete_option( 'allowed_themes' );
1309                          restore_current_blog();
1310                     }
1311                }
1312           }
1313
1314           /** This filter is documented in wp-includes/class-wp-theme.php */
1315           return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1316      }
1317
1318      /**
1319       * Sorts themes by name.
1320       *
1321       * @since 3.4.0
1322       *
1323       * @static
1324       * @access public