wpfts_start_sysvars (Filter)
The wpfts_start_sysvars
filter in WP Fast Total Search allows developers to modify system variables that are set at the beginning of the search query processing in the WPFTS_QueryLog::Start()
method. This provides the ability to influence the plugin’s logic at an early stage and add or modify system information that will be available throughout the query processing.
When to Use
This filter can be useful if you need to:
- Add your own system variables: You can add additional variables to the
$sysvars
array, which will be accessible in other parts of the plugin. - Modify the values of existing system variables: For example, you can change the
is_qlog_enabled
flag to enable or disable query logging. - Debug the query processing: You can use this filter to output the values of system variables and debug your integration with WPFTS.
Arguments
$sysvars
(array): An associative array of system variables. Contains keys such as:qlog_settings
(array): Query logging settings.is_detailed_log
(bool): Detailed logging flag.is_qlog_enabled
(bool): Query logging enabled flag.is_main_query
(bool): Flag indicating whether the query is the main WordPress query.is_admin
(bool): Flag indicating whether the query is executed in the admin panel.
$wpq
(object): TheWP_Query
object containing the parameters of the current query.
Return Value
$sysvars
(array): The modified array of system variables.
Example (Adding a new system variable)
add_filter('wpfts_start_sysvars', 'add_my_sysvar', 10, 2);
function add_my_sysvar($sysvars, $wpq)
{
$sysvars['my_custom_var'] = 'my_custom_value';
return $sysvars;
}
Important Notes
- The
wpfts_start_sysvars
filter is called in theWPFTS_QueryLog::Start()
method. - Changes made to the
$sysvars
array will be available in other parts of the plugin that use these variables. - Be careful when modifying system variables, as this may affect the plugin’s functionality.
This filter provides developers with access to WPFTS system variables at an early stage of query processing, which can be useful for debugging and fine-tuning integration with the plugin.