
如何执行WordPress数据库搜索和替换
wp_get_active_network_plugins ( No parameters )
wp_get_active_network_plugins: 这个函数返回一个WordPress多站点网络的活动插件数组。
返回要包含在全局范围内的网络插件文件数组。
默认目录是wp-content/plugins。要手动改变默认目录,在`wp-config.php`中定义`WP_PLUGIN_DIR`和`WP_PLUGIN_URL`。
function wp_get_active_network_plugins() { $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); if ( empty( $active_plugins ) ) { return array(); } $plugins = array(); $active_plugins = array_keys( $active_plugins ); sort( $active_plugins ); foreach ( $active_plugins as $plugin ) { if ( ! validate_file( $plugin ) // $plugin must validate as file. && '.php' === substr( $plugin, -4 ) // $plugin must end with '.php'. && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist. ) { $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; } } return $plugins; }