Skip to content

Commit

Permalink
Remove unused condition in_array( array)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhijitNage123 committed Jun 11, 2021
1 parent 6913862 commit 0bef1f8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions class-unlist-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ function post_navigation_clause( $where ) {
$hidden_posts = get_option( 'unlist_posts', array() );

// bail if none of the posts are hidden or we are on admin page or singular page.
if ( ( is_admin() && ! wp_doing_ajax() ) || in_array( get_the_ID(), $hidden_posts, true ) || empty( $hidden_posts ) ) {
if ( ( is_admin() && ! wp_doing_ajax() ) || empty( $hidden_posts ) ) { // condition run when user already on unlisted post.
if ( ( is_admin() && ! wp_doing_ajax() ) || empty( $hidden_posts ) ) {
return $where;
}
}

$where .= ' AND p.ID NOT IN ( ' . esc_sql( $this->hidden_post_string() ) . ' ) ';
Expand Down Expand Up @@ -204,10 +202,8 @@ public function comments_clauses( $clauses, $query ) {
$hidden_posts = get_option( 'unlist_posts', array() );

// bail if none of the posts are hidden or we are on admin page or singular page.
if ( ( is_admin() && ! wp_doing_ajax() ) || !in_array( get_the_ID(), $hidden_posts, true ) || empty( $hidden_posts ) ) {
if ( ( is_admin() && ! wp_doing_ajax() ) || empty( $hidden_posts ) ) { // condition run when user already on unlisted post.
if ( ( is_admin() && ! wp_doing_ajax() ) || empty( $hidden_posts ) ) {
return $clauses;
}
}

$where = $clauses['where'];
Expand Down

0 comments on commit 0bef1f8

Please sign in to comment.