Answers for "wordpress get last query"

PHP
0

wpdb get last query

echo $wpdb->last_query;
Posted by: Guest on October-15-2020
0

query lastet wp

<?php

    // The Query
    $next_args = array(
                    'post_type' => '<your_post_type>',
                    'post_status' => 'publish',
                    'posts_per_page'=>2,
                    'order'=>'DESC',
                    'orderby'=>'ID',
                    );

    $the_query = new WP_Query( $args );

    // The Loop
    if ( $the_query->have_posts() ) {
        $not_in_next_three = array();
        while ( $the_query->have_posts() ) {
            $the_query->the_post();
            //your html here for latest 2
            $not_in_next_three[] = get_the_ID();
        }

    } else {
        // no posts found
    }
    /* Restore original Post Data */
    wp_reset_postdata();
Posted by: Guest on September-04-2021

Browse Popular Code Answers by Language