Skip to content

Commit

Permalink
Add comments explaining conditional logic in the maybe_hide_* methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
anaemnesis committed Jul 7, 2023
1 parent 82e75e6 commit 27b3be7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions includes/class-wp-job-manager-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,18 @@ public function maybe_hide_filled_job_listings( WP_Query $query ): void {
return;
}

/**
* We want to ensure this only runs when: (1) not in admin and (2) the query is the main query and (3) the query
* is either a search query or an archive query. This is to address complications stemming from the following
* feature request: https://github.com/Automattic/WP-Job-Manager/issues/1884
*
* See also:
*
* https://github.com/Automattic/WP-Job-Manager/pull/1570
* https://github.com/Automattic/WP-Job-Manager/pull/2367
* https://github.com/Automattic/WP-Job-Manager/issues/2423
*/

if (
! is_admin()
&& $query->is_main_query()
Expand All @@ -729,6 +741,11 @@ public function maybe_hide_expired_job_listings( WP_Query $query ): void {
return;
}

/**
* We want to ensure this only runs when: (1) not in admin and (2) the query is the main query and (3) the query.
* See the comment in the maybe_hide_filled_job_listings() method for more information.
*/

if (
! is_admin()
&& $query->is_main_query()
Expand Down

0 comments on commit 27b3be7

Please sign in to comment.