Recent

CRP_Core_Query class

CRP_Core_Query

Contextual Related Posts: Main CRP Class.

Namespace: WebberZone\Contextual_Related_Posts
Since: 3.0.0
Source: includes/class-crp-core-query.php line 25

Methods

__construct()

Main constructor.

Since: 3.0.0
Line: 145

public function __construct( $args = ... );
TypeNameDescription
array|string$argsThe Query variables. Accepts an array or a query string.

hooks()

Initialise search hooks.

Since: 3.5.0
Line: 165

public function hooks(  );

prepare_query_args()

Prepare the query variables.

Since: 3.0.0
Line: 193

public function prepare_query_args( $args = ... );
TypeNameDescription
string|array$args{

get_match_sql()

Get the MATCH sql.

Since: 3.0.0
Line: 547

public function get_match_sql(  ): string;

Returns: string — Updated Fields

is_backlogged()

Check if MySQL is currently under heavy load.

Since: 4.2.0
Line: 676

public function is_backlogged(  ): bool;

Returns: bool — True if the database is considered backlogged.

pre_get_posts()

Modify the pre_get_posts clause.

Since: 3.5.0
Line: 739

public function pre_get_posts( $query );
TypeNameDescription
\WP_Query$queryThe WP_Query instance.

posts_fields()

Modify the SELECT clause - posts_fields.

Since: 3.0.0
Line: 784

public function posts_fields( $fields, $query ): string;
TypeNameDescription
string$fieldsThe SELECT clause of the query.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: string — Updated Fields

posts_join()

Modify the posts_join clause.

Since: 3.0.0
Line: 826

public function posts_join( $join, $query ): string;
TypeNameDescription
string$joinThe JOIN clause of the query.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: string — Updated JOIN

posts_where()

Modify the posts_where clause.

Since: 3.0.0
Line: 873

public function posts_where( $where, $query ): string;
TypeNameDescription
string$whereThe WHERE clause of the query.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: string — Updated WHERE

posts_orderby()

Modify the posts_orderby clause.

Since: 4.3.0
Line: 991

public function posts_orderby( $orderby, $query ): string;
TypeNameDescription
string$orderbyThe ORDER BY clause of the query.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: string — Updated ORDER BY

posts_groupby()

Modify the posts_groupby clause.

Since: 3.0.0
Line: 1083

public function posts_groupby( $groupby, $query ): string;
TypeNameDescription
string$groupbyThe GROUP BY clause of the query.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: string — Updated GROUP BY

posts_request()

Modify the completed SQL query before sending.

Since: 3.0.0
Line: 1115

public function posts_request( $sql, $query ): string;
TypeNameDescription
string$sqlThe complete SQL query.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: string — Updated SQL query.

posts_pre_query()

Filter posts_pre_query to allow caching to work.

Since: 3.0.0
Line: 1170

public function posts_pre_query( $posts, $query ): \WP_Post[];
TypeNameDescription
\WP_Post[]$postsArray of post data.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance.

Returns: \WP_Post[] — Updated Array of post objects.

the_posts()

Modify the array of retrieved posts.

Since: 3.0.0
Line: 1240

public function the_posts( $posts, $query ): \WP_Post[];
TypeNameDescription
\WP_Post[]$postsArray of post objects.
\WP_Query|\CRP_Query$queryThe WP_Query or CRP_Query instance (passed by reference).

Returns: \WP_Post[] — Updated Array of post objects.

exclude_post_ids()

Exclude Post IDs. Allows other plugins/functions to hook onto this and extend the list.

Line: 1390

public function exclude_post_ids( $args ): array;
TypeNameDescription
array$argsArray of arguments for CRP_Query.

Returns: array — Array of post IDs to exclude.

should_cache()

Check if the output should be cached.

Since: 4.2.0
Line: 1494

public function should_cache(  ): bool;

Returns: bool — True if the output should be cached.