wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



is_network_only_plugin › WordPress Function

Depuis3.0.0
Dépréciéen/a
› is_network_only_plugin ( $plugin )
Paramètres:
  • (string) $plugin Path to the plugin file. Accepts a path relative to the plugins directory, or an absolute path, with or without surrounding whitespace.
    Requis: Oui
Retourne:
  • (bool) True if plugin is network only, false otherwise.
Défini(e) dans:
Codex:
Changelog:
  • 7.1.1

Checks for "Network: true" in the plugin header to see if this should be activated only as a network wide plugin. The plugin would also work when Multisite is not enabled.

Checks for "Site Wide Only: true" for backward compatibility.


Source

function is_network_only_plugin( $plugin ) {
	// Normalize the path the same way activate_plugin() does, so both agree on the file.
	$plugin = plugin_basename( trim( $plugin ) );

	$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
	if ( $plugin_data ) {
		return $plugin_data['Network'];
	}
	return false;
}