wpseek.com
A WordPress-centric search engine for devs and theme authors
validate_active_plugins › WordPress Function
Since2.5.0
Deprecatedn/a
› validate_active_plugins ( No parameters )
Returns: |
|
Defined at: |
|
Codex: |
Validates active plugins.
Validate all active plugins, deactivates invalid and returns an array of deactivated ones.Related Functions: validate_plugin, deactivate_plugins, activate_plugins, wp_ajax_activate_plugin, _validate_cache_id
Source
function validate_active_plugins() { $plugins = get_option( 'active_plugins', array() ); // Validate vartype: array. if ( ! is_array( $plugins ) ) { update_option( 'active_plugins', array() ); $plugins = array(); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); $plugins = array_merge( $plugins, array_keys( $network_plugins ) ); } if ( empty( $plugins ) ) { return array(); } $invalid = array(); // Invalid plugins get deactivated. foreach ( $plugins as $plugin ) { $result = validate_plugin( $plugin ); if ( is_wp_error( $result ) ) { $invalid[ $plugin ] = $result; deactivate_plugins( $plugin, true ); } } return $invalid; }