Pro
Class to load all the pro features.
Namespace: WebberZone\Better_Search\Pro
Source: includes/class-pro.php line 20
Methods
__construct()
Constructor.
Line: 91
public function __construct( );
exclude_special_pages()
Exclude special pages (front and posts pages) from search results.
Since: 4.3.0
Line: 137
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: 169
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: 212
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: 232
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: 277
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: 311
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: 329
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: 375
static public function free_hooks( ): void;
Returns: void