wpfts_feature_number (Filter)

The wpfts_feature_number filter in WP Fast Total Search is designed to control the functionality of the FeatureDetector() function within the WPFTS_Core class. This function is responsible for detecting specific characteristics of the WordPress environment and displaying corresponding notifications in the admin panel, such as the presence of a large number of files of certain types, insufficient memory limits, etc.

When Used

This filter can be used to completely disable the FeatureDetector() function or to selectively disable specific checks.

Arguments

  • $is_feature_number (int): Feature number. 0 - default (all checks enabled).

Return Value

  • $is_feature_number (int): Feature number. Returning a value less than 1 will disable the FeatureDetector() function. Returning a value greater than 0 will allow the function to execute.

Example (Complete disabiling of FeatureDetector)

add_filter('wpfts_feature_number', 'disable_feature_detector');
function disable_feature_detector($is_feature_number) {
  return 0; // Disables FeatureDetector.
}

Example (Selective disabling of file checks)

This example shows how to disable the file presence check using the wpfts_feature_number filter. However, the plugin’s code implementation of this filter does not provide selective disabling of checks. The filter either completely disables the FeatureDetector() function or allows it to execute. This limitation should be noted in the documentation.

Important Notes

  • The wpfts_feature_number filter is called within the FeatureDetector() method of the WPFTS_Core class.
  • The return value must be an integer.

The wpfts_feature_number filter provides developers with the ability to disable or modify the logic of the FeatureDetector() function, which may be useful in some cases. However, the current implementation of the filter lacks flexibility for selective disabling of checks. Consider adding this capability in future plugin versions.