Filter hook 'network_allowed_themes'

in WP Core File wp-includes/class-wp-theme.php at line 1668

View Source

network_allowed_themes

Filter Hook
Description
Filters the array of themes allowed on the network. Site is provided as context so that a list of network allowed themes can be filtered further.

Hook Information

File Location wp-includes/class-wp-theme.php View on GitHub
Hook Type Filter
Line Number 1668

Hook Parameters

Type Name Description
string[] $allowed_themes An array of theme stylesheet names.
int $blog_id ID of the site.

Usage Examples

Basic Usage
<?php
// Hook into network_allowed_themes
add_filter('network_allowed_themes', 'my_custom_filter', 10, 2);

function my_custom_filter($allowed_themes, $blog_id) {
    // Your custom filtering logic here
    return $allowed_themes;
}

Source Code Context

wp-includes/class-wp-theme.php:1668 - How this hook is used in WordPress core
<?php
1663  		 * @since 4.5.0
1664  		 *
1665  		 * @param string[] $allowed_themes An array of theme stylesheet names.
1666  		 * @param int      $blog_id        ID of the site.
1667  		 */
1668  		$network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id );
1669  		return $network + self::get_allowed_on_site( $blog_id );
1670  	}
1671  
1672  	/**
1673  	 * Returns array of stylesheet names of themes allowed on the network.

PHP Documentation

<?php
/**
		 * Filters the array of themes allowed on the network.
		 *
		 * Site is provided as context so that a list of network allowed themes can
		 * be filtered further.
		 *
		 * @since 4.5.0
		 *
		 * @param string[] $allowed_themes An array of theme stylesheet names.
		 * @param int      $blog_id        ID of the site.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-theme.php
Related Hooks

Related hooks will be displayed here in future updates.