Pro
Class to load all the pro features.
Namespace: WebberZone\Better_Search\Pro
Source: includes/pro/class-pro.php line 22
Methods
__construct()
Constructor.
Line: 120
public function __construct( );
exclude_special_pages()
Exclude special pages (front and posts pages) from search results.
Since: 4.3.0
Line: 184
public function exclude_special_pages( $exclude_post_ids, $args ): int[];
| Type | Name | Description |
|---|---|---|
int[] |
$exclude_post_ids |
Array of post IDs to exclude. |
array |
$args |
Query arguments. |
Returns: int[] — Modified array of post IDs to exclude.
set_min_relevance()
Set the minimum relevance for the search query.
Since: 4.0.0
Line: 216
public function set_min_relevance( $request, $query, $instance ): string;
| Type | Name | Description |
|---|---|---|
string |
$request |
The request string. |
\WP_Query |
$query |
The WP_Query instance. |
\Better_Search_Core_Query |
$instance |
The Better_Search_Core_Query instance. |
Returns: string — Modified request string.
add_custom_clauses()
Add custom clauses to the search query.
Since: 4.0.0
Line: 259
public function add_custom_clauses( $clauses, $term, $like_op, $andor_op, $query, $instance ): array;
| Type | Name | Description |
|---|---|---|
array |
$clauses |
Array of clauses. |
string |
$term |
The search term (prepared for LIKE). |
string |
$like_op |
The LIKE operator. |
string |
$andor_op |
The AND/OR operator. |
\WP_Query |
$query |
The WP_Query instance. |
\Better_Search_Core_Query |
$instance |
The Better_Search_Core_Query instance. |
Returns: array — Array of clauses.
like_fallback_search()
Perform LIKE-based fallback search when FULLTEXT returns zero results.
Since: 4.2.0
Line: 279
public function like_fallback_search( $posts, $query, $instance ): \WP_Post[];
| Type | Name | Description |
|---|---|---|
\WP_Post[] |
$posts |
Array of post objects. |
\WP_Query |
$query |
The WP_Query instance. |
\Better_Search_Core_Query |
$instance |
The Better_Search_Core_Query instance. |
Returns: \WP_Post[] — Array of post objects, potentially with fallback results.
update_rest_post_search_query()
Modify the search query to add minimum relevance.
Since: 4.0.0
Line: 324
public function update_rest_post_search_query( $args, $request ): array;
| Type | Name | Description |
|---|---|---|
array |
$args |
Array of query arguments. |
array |
$request |
Array of request parameters. |
Returns: array — Modified query arguments.
init_rest_api_hooks()
Initialize REST API hooks.
Since: 4.2.0
Line: 358
public function init_rest_api_hooks( ): void;
Returns: void
modify_rest_post_query()
Modify REST post queries to use Better Search when better_search_query parameter is present.
Since: 4.2.0
Line: 376
public function modify_rest_post_query( array $args, $request ): array;
| Type | Name | Description |
|---|---|---|
array |
$args |
Array of arguments for WP_Query. |
\WP_REST_Request |
$request |
The REST request object. |
Returns: array — Modified query arguments.
free_hooks() static
Initialize hooks that should run even when Pro class isn’t instantiated. This allows certain Pro features to work in free version contexts.
Since: 4.2.0
Line: 422
static public function free_hooks( ): void;
Returns: void
update_fulltext_indexes() static
Register the post excerpt FULLTEXT index.
Pro folds the excerpt into the FULLTEXT MATCH; free only searches it via LIKE, so the index is registered here rather than in the shared index list.
Since: 4.4.0
Line: 440
static public function update_fulltext_indexes( $indexes ): array;
| Type | Name | Description |
|---|---|---|
array |
$indexes |
Array of fulltext indexes. |
Returns: array — Updated array of fulltext indexes.