Changeset 3830701 for vabelon/trunk/src/Routing/QueryLanguage.php
- Timestamp:
- 11/28/2026 01:28:33 AM (less than one hour ago)
- File:
-
- 1 edited
-
vabelon/trunk/src/Routing/QueryLanguage.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vabelon/trunk/src/Routing/QueryLanguage.php
r3827447 r3830701 18 18 defined( 'ABSPATH' ) || exit; 19 19 20 /** 21 * Query scoping. 22 */ 20 23 21 final class QueryLanguage { 24 22 25 /** 26 * Hook the scoping into WordPress. 27 * 28 * @return void 29 */ 23 /** @return void */ 30 24 public function register(): void { 31 25 add_action( 'pre_get_posts', array( $this, 'scope' ), 1 ); … … 35 29 36 30 /** 37 * Limit a list query to one language.38 *39 * A request for one specific post is left alone: StaticPages sends it to its own address.40 *41 31 * @param WP_Query $query Query about to run. 42 32 * @return void … … 47 37 return; 48 38 } 49 // WordPress leaves the post type empty on the blog index, search, feeds and most archives. 39 50 40 $types = array_filter( 51 41 (array) $query->get( 'post_type' ), … … 76 66 77 67 /** 78 * Keep the previous and next post links inside the language of the post being viewed.79 *80 68 * @param mixed $where WHERE clause of the adjacent post query; the posts table is aliased p. 81 69 * @param mixed $same Unused. … … 103 91 return $default ? $where : $where . ' AND 1 = 0'; 104 92 } 105 // $ids holds integers only, read from the language terms above. 93 106 94 return $where . ' AND p.ID ' . ( $default ? 'NOT IN' : 'IN' ) . " ( SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN ( " . implode( ',', $ids ) . ' ) )'; 107 95 }
Note:
See TracChangeset
for help on using the changeset viewer.