Recent

Multisite_Search class Pro only

Class to handle multisite search.

Namespace: WebberZone\Better_Search\Pro
Source: includes/class-multisite-search.php line 24

Methods

__construct()

Constructor.

Line: 54

public function __construct( Custom_Tables\Custom_Tables $custom_tables );
TypeNameDescription
Custom_Tables\Custom_Tables$custom_tablesCustom Tables instance.

pre_query_flat_table()

Short-circuit the database query for flat-table Better Search queries.

Fired via posts_pre_query at highest priority so we act after all other callbacks have had a chance to run but before WP_Query hits the DB. Returning a non-null value tells WP_Query to use that as the posts array and skip running the SQL statement.

Since: 4.2.0
Line: 113

public function pre_query_flat_table( $posts, $query ): null|array;
TypeNameDescription
null|array$postsNull (default) or an array of WP_Post objects supplied by an earlier filter.
WP_Query$queryCurrent query object.

Returns: null|array — Null to continue normally, empty array to cancel DB hit.

filter_posts_request()

Filter the posts request to include posts from all sites.

Since: 4.0.0
Line: 164

public function filter_posts_request( $request, $query, $instance ): string;
TypeNameDescription
string$requestThe SQL query.
WP_Query$queryThe WP_Query instance (passed by reference).
Better_Search_Core_Query$instanceThe Better_Search instance (passed by reference).

Returns: string — Updated SQL query.

prevent_recursive_query()

Prevent recursive queries by returning an empty array for nested better_search_query.

Since: 4.0.6
Line: 347

public function prevent_recursive_query( $posts, $query ): array;
TypeNameDescription
array$postsArray of post objects.
WP_Query$queryThe WP_Query instance (passed by reference).

Returns: array — Modified array of post objects.

handle_polylang_compatibility()

Handle Polylang compatibility.

Since: 4.0.6
Line: 361

public function handle_polylang_compatibility( $remove = ... );
TypeNameDescription
bool$removeWhether to remove the filter or not. Default is true.

validate_sites() static

Validate the sites.

Line: 382

static public function validate_sites( $sites ): int[];
TypeNameDescription
mixed[]$sitesArray of site IDs, possibly containing invalid entries from stored options.

Returns: int[] — Array of validated site IDs.

switch_to_blog_in_loop()

Update the_post while WP_Query loops through this.

Since: 4.0.0
Line: 401

public function switch_to_blog_in_loop( $post );
TypeNameDescription
WP_Post$postThe Post object (passed by reference).

Filter permalinks for multisite search results.

Since: 4.0.6
Line: 429

public function filter_the_permalink_for_multisite( $permalink, $current_post ): string;
TypeNameDescription
string$permalinkThe post’s permalink.
WP_Post|int$current_postPost object or post ID.

Returns: string — Modified permalink for cross-site posts.

filter_the_title_for_multisite()

Filters the post title for multisite installations.

Retrieves the correct title when displaying cross-site posts in search results.

Since: 4.0.6
Line: 479

public function filter_the_title_for_multisite( $title, $id ): string;
TypeNameDescription
string$titleThe post title.
int$idThe post ID.

Returns: string — Filtered post title.

loop_end()

Restore current blog on loop end.

Since: 4.0.0
Line: 507

public function loop_end(  );

filter_the_posts()

Hydrate results manually from the custom table and return WP_Post objects.

Since: 4.2.0
Line: 528

public function filter_the_posts( $posts, $query, $instance ): WP_Post[]|array;
TypeNameDescription
WP_Post[]$postsPosts.
WP_Query$queryWP_Query object.
Better_Search_Core_Query$instanceBetter_Search_Core_Query instance.

Returns: WP_Post[]|array — Array of posts.

render_page()

Render the network admin page.

Since: 4.0.0
Line: 754

public function render_page(  );

ajax_run_collation_fix()

AJAX handler to run collation fix for a given site.

Line: 1007

public function ajax_run_collation_fix(  );