IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
3383 | 3383 | |
3384 | 3384 | if ( ! empty($groupby) ) |
3385 | 3385 | $groupby = 'GROUP BY ' . $groupby; |
3386 | | if ( !empty( $orderby ) ) |
| 3386 | if ( !empty( $orderby ) ) { |
3387 | 3387 | $orderby = 'ORDER BY ' . $orderby; |
| 3388 | |
| 3389 | /** |
| 3390 | * Replace the standard MySQL rand() with an improved version. |
| 3391 | * |
| 3392 | * @link https://core.trac.wordpress.org/ticket/18836 |
| 3393 | * @link http://stackoverflow.com/a/25882872 |
| 3394 | */ |
| 3395 | if ( 0 === strcasecmp( $orderby, 'ORDER BY RAND()' ) ) { |
| 3396 | $orderby = "AND ( rand() <= " . $q['posts_per_page'] . " * 2 / ( SELECT count(*) FROM $wpdb->posts $join WHERE 1=1 $where $groupby ) )"; |
| 3397 | } |
| 3398 | } |
3388 | 3399 | |
3389 | 3400 | $found_rows = ''; |
3390 | 3401 | if ( !$q['no_found_rows'] && !empty($limits) ) |