Refers only to FiboSearch Pro

The search endpoint URL is blocked

This solution has worked since FiboSearch Pro v1.15.0.

Reason

FiboSearch Pro uses a custom AJAX endpoint URL to send requests for search results. This endpoint has the following URL structure:

https://your-domain.com/wp-content/plugins/ajax-search-for-woocommerce-premium/includes/Engines/TNTSearchMySQL/Endpoints/search.php?s=test

Some security plugins or firewalls such as Securi Security or firewall from GoDaddy WordPress hosting might prevent the execution of PHP files that are located in wp-content or wp-content/plugins directories.

Solution

We prepared solutions for popular security plugins. If you use iThemes Security, Sucuri Security, or WP Defender and your endpoint is blocked, learn more about possible solutions for these plugins. If you didn’t have these plugins and your endpoint is still blocked, read on.

The solution is to create another endpoint in the root directory where your WordPress is installed and point FiboSearch to use the new endpoint URL.

Step 1 – Create a new file in the WordPress root directory

Create an empty PHP file with name search.php in the WordPress root directory. It should be the same level where you have wp-config.php. For many hosting providers, it will be public_html/search.php

Step 2 – Add the following snippet to this new file

<?php

/**
 * Custom FiboSearch endpoint
 */

define( 'SHORTINIT', true );

$wp_load = 'wp-load.php';

if ( file_exists( $wp_load ) ) {

    require_once $wp_load;

    $endpoint = 'wp-content/plugins/ajax-search-for-woocommerce-premium/includes/Engines/TNTSearchMySQL/Endpoints/search.php';

    if ( file_exists( $endpoint ) ) {
        require_once $endpoint;
    }
}

Step 3 – Point the new endpoint

Add the following snippet to your functions.php file or use e.g. the CodeSnippets plugin.

add_filter( 'dgwt/wcas/endpoint/search', function ( $endpoint ) {
	return home_url( '/search.php' );
} );

Step 4 – Check if the endpoint works

Go to WooCommerce -> FiboSearch. If you don’t see a “Troubleshooting” tab, it means that the problem was solved. If you see “Troubleshooting” tab, click the button “Check status again”. If everything is ok, this tab should disappear.


Why do we use a custom AJAX endpoint instead of using admin-ajax.php or WP REST API? (only for geeks)

Every time when someone types something in the FiboSearch bar, JavaScript sends a request to this endpoint for search results.

Why do we use a custom endpoint instead of using admin-ajax.php or WP REST API? The answer is simple. Because of speed, speed, and one more time speed.

Using a custom search endpoint, WordPress can be loaded under special SHORTINIT mode by defining a constant define( 'SHORTINIT', true );. Then WordPress reduces initializing to a minimum. No plugins are loaded. No theme is loaded and a lot of WordPress core files aren’t loaded. You can use the $wpdb object and own scripts.

This means that every search query doesn’t need to load unnecessary files that are redundant in the search context. It’s a huge benefit. Imagine you have 50 plugins and every search query requires loading all of these plugins and executing plenty of SQLs and calculation that are not related to the search request. It’s ridiculous, but it happens in WordPress by default if you use admin-ajax.php or WP REST API.

As the result, the search is always fast, no matter how many plugins you have or how your website is optimized or not optimized.