mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-02 01:01:18 +03:00
Restrict any pledges with no contributors from being shown on the frontend
This commit is contained in:
parent
85b8b38ed0
commit
ad234eb045
|
@ -143,9 +143,23 @@ function filter_query( $query ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up meta queries to include the "valid pledge" check, added to both search and any pledge requests.
|
||||||
|
$meta_queries = (array) $query->get( 'meta_query' );
|
||||||
|
$meta_queries[] = array(
|
||||||
|
'key' => META_PREFIX . 'org-number-employees',
|
||||||
|
'value' => 0,
|
||||||
|
'compare' => '>',
|
||||||
|
'type' => 'NUMERIC',
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( CPT_ID === $query->get( 'post_type' ) ) {
|
||||||
|
$query->set( 'meta_query', $meta_queries );
|
||||||
|
}
|
||||||
|
|
||||||
// Searching is restricted to pledges only.
|
// Searching is restricted to pledges only.
|
||||||
if ( $query->is_search ) {
|
if ( $query->is_search ) {
|
||||||
$query->set( 'post_type', CPT_ID );
|
$query->set( 'post_type', CPT_ID );
|
||||||
|
$query->set( 'meta_query', $meta_queries );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the custom order param to sort the archive page.
|
// Use the custom order param to sort the archive page.
|
||||||
|
|
Loading…
Reference in a new issue