|
@@ 3303-3398 (lines=96) @@
|
| 3300 |
|
* Apply post-paging filters on where and join. Only plugins that |
| 3301 |
|
* manipulate paging queries should use these hooks. |
| 3302 |
|
*/ |
| 3303 |
|
if ( !$q['suppress_filters'] ) { |
| 3304 |
|
/** |
| 3305 |
|
* Filter the WHERE clause of the query. |
| 3306 |
|
* |
| 3307 |
|
* Specifically for manipulating paging queries. |
| 3308 |
|
* |
| 3309 |
|
* @since 1.5.0 |
| 3310 |
|
* |
| 3311 |
|
* @param string $where The WHERE clause of the query. |
| 3312 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3313 |
|
*/ |
| 3314 |
|
$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) ); |
| 3315 |
|
|
| 3316 |
|
/** |
| 3317 |
|
* Filter the GROUP BY clause of the query. |
| 3318 |
|
* |
| 3319 |
|
* @since 2.0.0 |
| 3320 |
|
* |
| 3321 |
|
* @param string $groupby The GROUP BY clause of the query. |
| 3322 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3323 |
|
*/ |
| 3324 |
|
$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) ); |
| 3325 |
|
|
| 3326 |
|
/** |
| 3327 |
|
* Filter the JOIN clause of the query. |
| 3328 |
|
* |
| 3329 |
|
* Specifically for manipulating paging queries. |
| 3330 |
|
* |
| 3331 |
|
* @since 1.5.0 |
| 3332 |
|
* |
| 3333 |
|
* @param string $join The JOIN clause of the query. |
| 3334 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3335 |
|
*/ |
| 3336 |
|
$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) ); |
| 3337 |
|
|
| 3338 |
|
/** |
| 3339 |
|
* Filter the ORDER BY clause of the query. |
| 3340 |
|
* |
| 3341 |
|
* @since 1.5.1 |
| 3342 |
|
* |
| 3343 |
|
* @param string $orderby The ORDER BY clause of the query. |
| 3344 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3345 |
|
*/ |
| 3346 |
|
$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) ); |
| 3347 |
|
|
| 3348 |
|
/** |
| 3349 |
|
* Filter the DISTINCT clause of the query. |
| 3350 |
|
* |
| 3351 |
|
* @since 2.1.0 |
| 3352 |
|
* |
| 3353 |
|
* @param string $distinct The DISTINCT clause of the query. |
| 3354 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3355 |
|
*/ |
| 3356 |
|
$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) ); |
| 3357 |
|
|
| 3358 |
|
/** |
| 3359 |
|
* Filter the LIMIT clause of the query. |
| 3360 |
|
* |
| 3361 |
|
* @since 2.1.0 |
| 3362 |
|
* |
| 3363 |
|
* @param string $limits The LIMIT clause of the query. |
| 3364 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3365 |
|
*/ |
| 3366 |
|
$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) ); |
| 3367 |
|
|
| 3368 |
|
/** |
| 3369 |
|
* Filter the SELECT clause of the query. |
| 3370 |
|
* |
| 3371 |
|
* @since 2.1.0 |
| 3372 |
|
* |
| 3373 |
|
* @param string $fields The SELECT clause of the query. |
| 3374 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3375 |
|
*/ |
| 3376 |
|
$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); |
| 3377 |
|
|
| 3378 |
|
/** |
| 3379 |
|
* Filter all query clauses at once, for convenience. |
| 3380 |
|
* |
| 3381 |
|
* Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, |
| 3382 |
|
* fields (SELECT), and LIMITS clauses. |
| 3383 |
|
* |
| 3384 |
|
* @since 3.1.0 |
| 3385 |
|
* |
| 3386 |
|
* @param array $clauses The list of clauses for the query. |
| 3387 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3388 |
|
*/ |
| 3389 |
|
$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) ); |
| 3390 |
|
|
| 3391 |
|
$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : ''; |
| 3392 |
|
$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : ''; |
| 3393 |
|
$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
| 3394 |
|
$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : ''; |
| 3395 |
|
$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : ''; |
| 3396 |
|
$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
| 3397 |
|
$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : ''; |
| 3398 |
|
} |
| 3399 |
|
|
| 3400 |
|
/** |
| 3401 |
|
* Fires to announce the query's current selection parameters. |
|
@@ 3415-3522 (lines=108) @@
|
| 3412 |
|
* Filter again for the benefit of caching plugins. |
| 3413 |
|
* Regular plugins should use the hooks above. |
| 3414 |
|
*/ |
| 3415 |
|
if ( !$q['suppress_filters'] ) { |
| 3416 |
|
/** |
| 3417 |
|
* Filter the WHERE clause of the query. |
| 3418 |
|
* |
| 3419 |
|
* For use by caching plugins. |
| 3420 |
|
* |
| 3421 |
|
* @since 2.5.0 |
| 3422 |
|
* |
| 3423 |
|
* @param string $where The WHERE clause of the query. |
| 3424 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3425 |
|
*/ |
| 3426 |
|
$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) ); |
| 3427 |
|
|
| 3428 |
|
/** |
| 3429 |
|
* Filter the GROUP BY clause of the query. |
| 3430 |
|
* |
| 3431 |
|
* For use by caching plugins. |
| 3432 |
|
* |
| 3433 |
|
* @since 2.5.0 |
| 3434 |
|
* |
| 3435 |
|
* @param string $groupby The GROUP BY clause of the query. |
| 3436 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3437 |
|
*/ |
| 3438 |
|
$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) ); |
| 3439 |
|
|
| 3440 |
|
/** |
| 3441 |
|
* Filter the JOIN clause of the query. |
| 3442 |
|
* |
| 3443 |
|
* For use by caching plugins. |
| 3444 |
|
* |
| 3445 |
|
* @since 2.5.0 |
| 3446 |
|
* |
| 3447 |
|
* @param string $join The JOIN clause of the query. |
| 3448 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3449 |
|
*/ |
| 3450 |
|
$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) ); |
| 3451 |
|
|
| 3452 |
|
/** |
| 3453 |
|
* Filter the ORDER BY clause of the query. |
| 3454 |
|
* |
| 3455 |
|
* For use by caching plugins. |
| 3456 |
|
* |
| 3457 |
|
* @since 2.5.0 |
| 3458 |
|
* |
| 3459 |
|
* @param string $orderby The ORDER BY clause of the query. |
| 3460 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3461 |
|
*/ |
| 3462 |
|
$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) ); |
| 3463 |
|
|
| 3464 |
|
/** |
| 3465 |
|
* Filter the DISTINCT clause of the query. |
| 3466 |
|
* |
| 3467 |
|
* For use by caching plugins. |
| 3468 |
|
* |
| 3469 |
|
* @since 2.5.0 |
| 3470 |
|
* |
| 3471 |
|
* @param string $distinct The DISTINCT clause of the query. |
| 3472 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3473 |
|
*/ |
| 3474 |
|
$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) ); |
| 3475 |
|
|
| 3476 |
|
/** |
| 3477 |
|
* Filter the SELECT clause of the query. |
| 3478 |
|
* |
| 3479 |
|
* For use by caching plugins. |
| 3480 |
|
* |
| 3481 |
|
* @since 2.5.0 |
| 3482 |
|
* |
| 3483 |
|
* @param string $fields The SELECT clause of the query. |
| 3484 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3485 |
|
*/ |
| 3486 |
|
$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) ); |
| 3487 |
|
|
| 3488 |
|
/** |
| 3489 |
|
* Filter the LIMIT clause of the query. |
| 3490 |
|
* |
| 3491 |
|
* For use by caching plugins. |
| 3492 |
|
* |
| 3493 |
|
* @since 2.5.0 |
| 3494 |
|
* |
| 3495 |
|
* @param string $limits The LIMIT clause of the query. |
| 3496 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3497 |
|
*/ |
| 3498 |
|
$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); |
| 3499 |
|
|
| 3500 |
|
/** |
| 3501 |
|
* Filter all query clauses at once, for convenience. |
| 3502 |
|
* |
| 3503 |
|
* For use by caching plugins. |
| 3504 |
|
* |
| 3505 |
|
* Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, |
| 3506 |
|
* fields (SELECT), and LIMITS clauses. |
| 3507 |
|
* |
| 3508 |
|
* @since 3.1.0 |
| 3509 |
|
* |
| 3510 |
|
* @param array $pieces The pieces of the query. |
| 3511 |
|
* @param WP_Query &$this The WP_Query instance (passed by reference). |
| 3512 |
|
*/ |
| 3513 |
|
$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) ); |
| 3514 |
|
|
| 3515 |
|
$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : ''; |
| 3516 |
|
$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : ''; |
| 3517 |
|
$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
| 3518 |
|
$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : ''; |
| 3519 |
|
$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : ''; |
| 3520 |
|
$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
| 3521 |
|
$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : ''; |
| 3522 |
|
} |
| 3523 |
|
|
| 3524 |
|
if ( ! empty($groupby) ) |
| 3525 |
|
$groupby = 'GROUP BY ' . $groupby; |