@@ 2521-2616 (lines=96) @@ | ||
2518 | * Apply post-paging filters on where and join. Only plugins that |
|
2519 | * manipulate paging queries should use these hooks. |
|
2520 | */ |
|
2521 | if ( !$q['suppress_filters'] ) { |
|
2522 | /** |
|
2523 | * Filters the WHERE clause of the query. |
|
2524 | * |
|
2525 | * Specifically for manipulating paging queries. |
|
2526 | * |
|
2527 | * @since 1.5.0 |
|
2528 | * |
|
2529 | * @param string $where The WHERE clause of the query. |
|
2530 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2531 | */ |
|
2532 | $where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) ); |
|
2533 | ||
2534 | /** |
|
2535 | * Filters the GROUP BY clause of the query. |
|
2536 | * |
|
2537 | * @since 2.0.0 |
|
2538 | * |
|
2539 | * @param string $groupby The GROUP BY clause of the query. |
|
2540 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2541 | */ |
|
2542 | $groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) ); |
|
2543 | ||
2544 | /** |
|
2545 | * Filters the JOIN clause of the query. |
|
2546 | * |
|
2547 | * Specifically for manipulating paging queries. |
|
2548 | * |
|
2549 | * @since 1.5.0 |
|
2550 | * |
|
2551 | * @param string $join The JOIN clause of the query. |
|
2552 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2553 | */ |
|
2554 | $join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) ); |
|
2555 | ||
2556 | /** |
|
2557 | * Filters the ORDER BY clause of the query. |
|
2558 | * |
|
2559 | * @since 1.5.1 |
|
2560 | * |
|
2561 | * @param string $orderby The ORDER BY clause of the query. |
|
2562 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2563 | */ |
|
2564 | $orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) ); |
|
2565 | ||
2566 | /** |
|
2567 | * Filters the DISTINCT clause of the query. |
|
2568 | * |
|
2569 | * @since 2.1.0 |
|
2570 | * |
|
2571 | * @param string $distinct The DISTINCT clause of the query. |
|
2572 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2573 | */ |
|
2574 | $distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) ); |
|
2575 | ||
2576 | /** |
|
2577 | * Filters the LIMIT clause of the query. |
|
2578 | * |
|
2579 | * @since 2.1.0 |
|
2580 | * |
|
2581 | * @param string $limits The LIMIT clause of the query. |
|
2582 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2583 | */ |
|
2584 | $limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) ); |
|
2585 | ||
2586 | /** |
|
2587 | * Filters the SELECT clause of the query. |
|
2588 | * |
|
2589 | * @since 2.1.0 |
|
2590 | * |
|
2591 | * @param string $fields The SELECT clause of the query. |
|
2592 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2593 | */ |
|
2594 | $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); |
|
2595 | ||
2596 | /** |
|
2597 | * Filters all query clauses at once, for convenience. |
|
2598 | * |
|
2599 | * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, |
|
2600 | * fields (SELECT), and LIMITS clauses. |
|
2601 | * |
|
2602 | * @since 3.1.0 |
|
2603 | * |
|
2604 | * @param array $clauses The list of clauses for the query. |
|
2605 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2606 | */ |
|
2607 | $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) ); |
|
2608 | ||
2609 | $where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : ''; |
|
2610 | $groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : ''; |
|
2611 | $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
|
2612 | $orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : ''; |
|
2613 | $distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : ''; |
|
2614 | $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
|
2615 | $limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : ''; |
|
2616 | } |
|
2617 | ||
2618 | /** |
|
2619 | * Fires to announce the query's current selection parameters. |
|
@@ 2633-2740 (lines=108) @@ | ||
2630 | * Filters again for the benefit of caching plugins. |
|
2631 | * Regular plugins should use the hooks above. |
|
2632 | */ |
|
2633 | if ( !$q['suppress_filters'] ) { |
|
2634 | /** |
|
2635 | * Filters the WHERE clause of the query. |
|
2636 | * |
|
2637 | * For use by caching plugins. |
|
2638 | * |
|
2639 | * @since 2.5.0 |
|
2640 | * |
|
2641 | * @param string $where The WHERE clause of the query. |
|
2642 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2643 | */ |
|
2644 | $where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) ); |
|
2645 | ||
2646 | /** |
|
2647 | * Filters the GROUP BY clause of the query. |
|
2648 | * |
|
2649 | * For use by caching plugins. |
|
2650 | * |
|
2651 | * @since 2.5.0 |
|
2652 | * |
|
2653 | * @param string $groupby The GROUP BY clause of the query. |
|
2654 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2655 | */ |
|
2656 | $groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) ); |
|
2657 | ||
2658 | /** |
|
2659 | * Filters the JOIN clause of the query. |
|
2660 | * |
|
2661 | * For use by caching plugins. |
|
2662 | * |
|
2663 | * @since 2.5.0 |
|
2664 | * |
|
2665 | * @param string $join The JOIN clause of the query. |
|
2666 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2667 | */ |
|
2668 | $join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) ); |
|
2669 | ||
2670 | /** |
|
2671 | * Filters the ORDER BY clause of the query. |
|
2672 | * |
|
2673 | * For use by caching plugins. |
|
2674 | * |
|
2675 | * @since 2.5.0 |
|
2676 | * |
|
2677 | * @param string $orderby The ORDER BY clause of the query. |
|
2678 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2679 | */ |
|
2680 | $orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) ); |
|
2681 | ||
2682 | /** |
|
2683 | * Filters the DISTINCT clause of the query. |
|
2684 | * |
|
2685 | * For use by caching plugins. |
|
2686 | * |
|
2687 | * @since 2.5.0 |
|
2688 | * |
|
2689 | * @param string $distinct The DISTINCT clause of the query. |
|
2690 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2691 | */ |
|
2692 | $distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) ); |
|
2693 | ||
2694 | /** |
|
2695 | * Filters the SELECT clause of the query. |
|
2696 | * |
|
2697 | * For use by caching plugins. |
|
2698 | * |
|
2699 | * @since 2.5.0 |
|
2700 | * |
|
2701 | * @param string $fields The SELECT clause of the query. |
|
2702 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2703 | */ |
|
2704 | $fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) ); |
|
2705 | ||
2706 | /** |
|
2707 | * Filters the LIMIT clause of the query. |
|
2708 | * |
|
2709 | * For use by caching plugins. |
|
2710 | * |
|
2711 | * @since 2.5.0 |
|
2712 | * |
|
2713 | * @param string $limits The LIMIT clause of the query. |
|
2714 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2715 | */ |
|
2716 | $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); |
|
2717 | ||
2718 | /** |
|
2719 | * Filters all query clauses at once, for convenience. |
|
2720 | * |
|
2721 | * For use by caching plugins. |
|
2722 | * |
|
2723 | * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, |
|
2724 | * fields (SELECT), and LIMITS clauses. |
|
2725 | * |
|
2726 | * @since 3.1.0 |
|
2727 | * |
|
2728 | * @param array $pieces The pieces of the query. |
|
2729 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
|
2730 | */ |
|
2731 | $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) ); |
|
2732 | ||
2733 | $where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : ''; |
|
2734 | $groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : ''; |
|
2735 | $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
|
2736 | $orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : ''; |
|
2737 | $distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : ''; |
|
2738 | $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
|
2739 | $limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : ''; |
|
2740 | } |
|
2741 | ||
2742 | if ( ! empty($groupby) ) |
|
2743 | $groupby = 'GROUP BY ' . $groupby; |