| Server IP : 35.201.19.92 / Your IP : 216.73.216.75 Web Server : nginx System : Linux pod-200961 6.8.0-1055-gke #61-Ubuntu SMP Tue May 26 22:57:42 UTC 2026 x86_64 User : fpm200098 ( 200098) PHP Version : 8.2.33 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nas/content/live/questfamilyday/wp-contentold/mu-plugins/ |
Upload File : |
<?php
/**
* Plugin Name: WPE ElasticPress Autosuggest Logger
* Plugin URI: https://wpengine.com
* Description: Appends search terms to the url when elasticpress autosuggest is enabled
* Version: 1.0.0
* Text Domain: wpe-elasticpress-autosuggest-logger
* Domain Path: /languages
* Author: WP Engine
* Author URI: https://wpengine.com/
* License: GPLv2
*
* @package WPEngine\wpe_elasticpress_autosuggest_logger
*/
define( 'WPENGINE_WPE_ES_AUTOSUGGEST_LOGGER_VERSION', '1.0.0' );
add_action( 'plugins_loaded', 'wpe_elasticpress_autosuggest_logger_loader' );
/**
* Registers all hooks necessary for the feature
*
* @since 1.0.0
*/
function wpe_elasticpress_autosuggest_logger_loader() {
// Check if this plugin has been disabled in the config file
if ( defined( 'DISABLE_WPE_ES_AUTOSUGGEST_LOGGER' ) && true === DISABLE_WPE_ES_AUTOSUGGEST_LOGGER ) {
return;
} else {
// Get active plugins
$active_plugins = get_option( 'active_plugins' );
// Check if get_option returns an array
if ( is_array( $active_plugins ) ) {
// Check if elasticpress plugin is activated
if ( in_array( 'elasticpress/elasticpress.php', $active_plugins, true ) ) {
// Enable autosuggest metrics script
add_action( 'wp_enqueue_scripts', 'wpe_elasticpress_autosuggest_logger_action_wp_enqueue_scripts' );
}
}
}
}
/**
* Action wp_enqueue_scripts
*
* Enqueue's necessary JavaScript required for processing
*
* @since 1.0.0
*/
function wpe_elasticpress_autosuggest_logger_action_wp_enqueue_scripts() {
// Get elasticpress feature settings
$ep_settings = get_option( 'ep_feature_settings' );
// If autosuggest is enabled register the autosuggest metrics script
if ( is_array( $ep_settings ) && isset( $ep_settings['autosuggest'] ) && isset( $ep_settings['autosuggest']['active'] ) && true === $ep_settings['autosuggest']['active'] ) {
$min = '-min';
$version = WPENGINE_WPE_ES_AUTOSUGGEST_LOGGER_VERSION;
$plugin_url = plugin_dir_url( __FILE__ );
if ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) {
$min = '';
$version = time();
}
wp_register_script( 'wpe-autosuggest-metrics', $plugin_url . 'wpe-elasticpress-autosuggest-logger/wpe-autosuggest' . $min . '.js', array( 'elasticpress-autosuggest' ), $version, true );
wp_enqueue_script( 'wpe-autosuggest-metrics' );
}
}