Super fast WP Search Suggest
-
In ‘/wp-content/’ folder create another folder: ‘mu-plugins’ (if does’n exists; ‘mu’ – must use).
In ‘/wp-content/mu-plugins/’ create file, ex.:
disable_plugins_when_wp_search_suggest.php
Add code into ‘disable_plugins_when_wp_search_suggest.php’:
<?php if ( ! function_exists('disable_plugins_when_wp_search_suggest') ) { add_filter( 'option_active_plugins', 'disable_plugins_when_wp_search_suggest' ); function disable_plugins_when_wp_search_suggest( $active_plugins ) { $uri = 'action=wp-search-suggest'; if ( false !== strpos( $_SERVER['REQUEST_URI'], $uri) ) { $for_enable = 'wp-search-suggest/wp-search-suggest.php'; $index = array_search($for_enable, $active_plugins); foreach( $active_plugins as $idx => $plugin ) { if ( $index !== array_search( $plugin, $active_plugins) ) { unset($active_plugins[$idx]); } } } return $active_plugins; } } ?>
Now all active plugins will not be loaded during the search except WP Search Suggest and server response time will be reduced by several times (from 1.5 seconds to 200 milliseconds with 30 active plugins for me).
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Super fast WP Search Suggest’ is closed to new replies.