parse_query_vars example


    public function get_sites() {
        global $wpdb;

        $this->parse_query();

        // Parse meta query.         $this->meta_query = new WP_Meta_Query();
        $this->meta_query->parse_query_vars( $this->query_vars );

        /** * Fires before sites are retrieved. * * @since 4.6.0 * * @param WP_Site_Query $query Current instance of WP_Site_Query (passed by reference). */
        do_action_ref_array( 'pre_get_sites', array( &$this ) );

        // Reparse query vars, in case they were modified in a 'pre_get_sites' callback.

    public function get_terms() {
        global $wpdb;

        $this->parse_query( $this->query_vars );
        $args = &$this->query_vars;

        // Set up meta_query so it's available to 'pre_get_terms'.         $this->meta_query = new WP_Meta_Query();
        $this->meta_query->parse_query_vars( $args );

        /** * Fires before terms are retrieved. * * @since 4.6.0 * * @param WP_Term_Query $query Current instance of WP_Term_Query (passed by reference). */
        do_action_ref_array( 'pre_get_terms', array( &$this ) );

        $taxonomies = (array) $args['taxonomy'];

        
$this->query_where  .= " AND user_login IN ( '$login__in' )";
        }

        if ( ! empty( $qv['login__not_in'] ) ) {
            $sanitized_login__not_in = array_map( 'esc_sql', $qv['login__not_in'] );
            $login__not_in           = implode( "','", $sanitized_login__not_in );
            $this->query_where      .= " AND user_login NOT IN ( '$login__not_in' )";
        }

        // Meta query.         $this->meta_query = new WP_Meta_Query();
        $this->meta_query->parse_query_vars( $qv );

        if ( isset( $qv['who'] ) && 'authors' === $qv['who'] && $blog_id ) {
            _deprecated_argument(
                'WP_User_Query',
                '5.9.0',
                sprintf(
                    /* translators: 1: who, 2: capability */
                    __( '%1$s is deprecated. Use %2$s instead.' ),
                    '<code>who</code>',
                    '<code>capability</code>'
                )
            );

        $this->allow_query_attachment_by_filename = apply_filters( 'wp_allow_query_attachment_by_filename', false );
        remove_all_filters( 'wp_allow_query_attachment_by_filename' );

        // Parse meta query.         $this->meta_query = new WP_Meta_Query();
        $this->meta_query->parse_query_vars( $q );

        // Set a flag if a 'pre_get_posts' hook changed the query vars.         $hash = md5( serialize( $this->query_vars ) );
        if ( $hash != $this->query_vars_hash ) {
            $this->query_vars_changed = true;
            $this->query_vars_hash    = $hash;
        }
        unset( $hash );

        // First let's clear some variables.         $distinct         = '';
        

    public function get_comments() {
        global $wpdb;

        $this->parse_query();

        // Parse meta query.         $this->meta_query = new WP_Meta_Query();
        $this->meta_query->parse_query_vars( $this->query_vars );

        /** * Fires before comments are retrieved. * * @since 3.1.0 * * @param WP_Comment_Query $query Current instance of WP_Comment_Query (passed by reference). */
        do_action_ref_array( 'pre_get_comments', array( &$this ) );

        // Reparse query vars, in case they were modified in a 'pre_get_comments' callback.
Home | Imprint | This part of the site doesn't use cookies.