Skip to content

Commit c62d55d

Browse files
committed
Refactor: Rename variable for comparison operator in get_adjacent_post function.
improve code clarity by renaming the `$op` variable to `$comparison_operator`,
1 parent 13ceba7 commit c62d55d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wp-includes/link-template.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,8 +1939,8 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
19391939
$where .= " AND p.post_status = 'publish'";
19401940
}
19411941

1942-
$op = $previous ? '<' : '>';
1943-
$order = $previous ? 'DESC' : 'ASC';
1942+
$comparison_operator = $previous ? '<' : '>';
1943+
$order = $previous ? 'DESC' : 'ASC';
19441944

19451945
/**
19461946
* Filters the JOIN clause in the SQL for an adjacent post query.
@@ -1965,7 +1965,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
19651965
$join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post );
19661966

19671967
// Prepare the where clause for the adjacent post query.
1968-
$where_prepared = $wpdb->prepare( "WHERE (p.post_date $op %s OR (p.post_date = %s AND p.ID $op %d)) AND p.post_type = %s $where", $current_post_date, $current_post_date, $post->ID, $post->post_type ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $op is a string literal, either '<' or '>'.
1968+
$where_prepared = $wpdb->prepare( "WHERE (p.post_date $comparison_operator %s OR (p.post_date = %s AND p.ID $comparison_operator %d)) AND p.post_type = %s $where", $current_post_date, $current_post_date, $post->ID, $post->post_type ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $comparison_operator is a string literal, either '<' or '>'.
19691969

19701970
/**
19711971
* Filters the WHERE clause in the SQL for an adjacent post query.

0 commit comments

Comments
 (0)