Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




deactivate_plugins [ WordPress Function ]

deactivate_plugins ( $plugins, $silent = false, $network_wide = null )
Parameters:
  • (string|array) $plugins Single plugin or list of plugins to deactivate.
  • (mixed) $network_wide Whether to deactivate the plugin for all sites in the network. A value of null (the default) will deactivate plugins for both the site and the network.
  • (bool) $silent Prevent calling deactivation hooks. Default is false.
Defined at:



Deactivate a single plugin or multiple plugins.

The deactivation hook is disabled by the plugin upgrader by using the $silent parameter.

Source


<?php
function deactivate_plugins$plugins$silent false$network_wide null ) {
    if ( 
is_multisite() )
        
$network_current get_site_option'active_sitewide_plugins', array() );
    
$current get_option'active_plugins', array() );
    
$do_blog $do_network false;

    foreach ( (array) 
$plugins as $plugin ) {
        
$plugin plugin_basenametrim$plugin ) );
        if ( ! 
is_plugin_active($plugin) )
            continue;

        
$network_deactivating false !== $network_wide && is_plugin_active_for_network$plugin );

        if ( ! 
$silent )
            
do_action'deactivate_plugin'$plugin$network_deactivating );

        if ( 
false !== $network_wide ) {
            if ( 
is_plugin_active_for_network$plugin ) ) {
                
$do_network true;
                unset( 
$network_current$plugin ] );
            } elseif ( 
$network_wide ) {
                continue;
            }
        }

        if ( 
true !== $network_wide ) {
            
$key array_search$plugin$current );
            if ( 
false !== $key ) {
                
$do_blog true;
                
array_splice$current$key);
            }
        }

        if ( ! 
$silent ) {
            
do_action'deactivate_' $plugin$network_deactivating );
            
do_action'deactivated_plugin'$plugin$network_deactivating );
        }
    }

    if ( 
$do_blog )
        
update_option('active_plugins'$current);
    if ( 
$do_network )
        
update_site_option'active_sitewide_plugins'$network_current );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics