Skip to content

Instantly share code, notes, and snippets.

@tranquangchau
Last active May 23, 2017 23:15
Show Gist options
  • Save tranquangchau/f19639b2822afbf1e39c83d4b5a7e89f to your computer and use it in GitHub Desktop.
Save tranquangchau/f19639b2822afbf1e39c83d4b5a7e89f to your computer and use it in GitHub Desktop.
var dum query
<?php
$posts_per_page = 10;
$args = array('post_type' => 'product',
'posts_per_page' => $posts_per_page,
'paged' => $paged,
'post_status' => 'publish',
//'orderby' => 'post_date',
'orderby' => 'post_content_filtered',
// 'order' => 'ASC',
'order' => 'DESC',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
//'field' => 'slug',
// 'terms' => 'bed-room'
'field' => 'cat_ID',
// 'terms' => array( '61', '60' )
'terms' => $list_slug
)
),
//'page_id'=>2
);
$portfolio = new WP_Query($args);
var_dump($portfolio);die;
object(WP_Query)[2284]
public 'query' =>
array (size=7)
'post_type' => string 'product' (length=7)
'posts_per_page' => int 10
'paged' => int 1
'post_status' => string 'publish' (length=7)
'orderby' => string 'post_content_filtered' (length=21)
'order' => string 'DESC' (length=4)
'tax_query' =>
array (size=2)
'relation' => string 'AND' (length=3)
0 =>
array (size=3)
...
public 'query_vars' =>
array (size=69)
'post_type' => string 'product' (length=7)
'posts_per_page' => int 10
'paged' => int 1
'post_status' => string 'publish' (length=7)
'orderby' => string 'post_content_filtered' (length=21)
'order' => string 'DESC' (length=4)
'tax_query' =>
array (size=2)
'relation' => string 'AND' (length=3)
0 =>
array (size=3)
...
'error' => string '' (length=0)
'm' => string '' (length=0)
'p' => int 0
'post_parent' => string '' (length=0)
'subpost' => string '' (length=0)
'subpost_id' => string '' (length=0)
'attachment' => string '' (length=0)
'attachment_id' => int 0
'name' => string '' (length=0)
'static' => string '' (length=0)
'pagename' => string '' (length=0)
'page_id' => int 0
'second' => string '' (length=0)
'minute' => string '' (length=0)
'hour' => string '' (length=0)
'day' => int 0
'monthnum' => int 0
'year' => int 0
'w' => int 0
'category_name' => string '' (length=0)
'tag' => string '' (length=0)
'cat' => string '' (length=0)
'tag_id' => string '' (length=0)
'author' => string '' (length=0)
'author_name' => string '' (length=0)
'feed' => string '' (length=0)
'tb' => string '' (length=0)
'meta_key' => string '' (length=0)
'meta_value' => string '' (length=0)
'preview' => string '' (length=0)
's' => string '' (length=0)
'sentence' => string '' (length=0)
'title' => string '' (length=0)
'fields' => string '' (length=0)
'menu_order' => string '' (length=0)
'embed' => string '' (length=0)
'category__in' =>
array (size=0)
empty
'category__not_in' =>
array (size=0)
empty
'category__and' =>
array (size=0)
empty
'post__in' =>
array (size=0)
empty
'post__not_in' =>
array (size=0)
empty
'post_name__in' =>
array (size=0)
empty
'tag__in' =>
array (size=0)
empty
'tag__not_in' =>
array (size=0)
empty
'tag__and' =>
array (size=0)
empty
'tag_slug__in' =>
array (size=0)
empty
'tag_slug__and' =>
array (size=0)
empty
'post_parent__in' =>
array (size=0)
empty
'post_parent__not_in' =>
array (size=0)
empty
'author__in' =>
array (size=0)
empty
'author__not_in' =>
array (size=0)
empty
'ignore_sticky_posts' => boolean false
'suppress_filters' => boolean false
'cache_results' => boolean true
'update_post_term_cache' => boolean true
'lazy_load_term_meta' => boolean true
'update_post_meta_cache' => boolean true
'nopaging' => boolean false
'comments_per_page' => string '50' (length=2)
'no_found_rows' => boolean false
'taxonomy' => string 'product_cat' (length=11)
'term_id' => int 60
public 'tax_query' =>
object(WP_Tax_Query)[2668]
public 'queries' =>
array (size=2)
'relation' => string 'AND' (length=3)
0 =>
array (size=5)
...
public 'relation' => string 'AND' (length=3)
protected 'table_aliases' =>
array (size=1)
0 => string 'wp_term_relationships' (length=21)
public 'queried_terms' =>
array (size=1)
'product_cat' =>
array (size=2)
...
public 'primary_table' => string 'wp_posts' (length=8)
public 'primary_id_column' => string 'ID' (length=2)
public 'meta_query' =>
object(WP_Meta_Query)[2669]
public 'queries' =>
array (size=0)
empty
public 'relation' => null
public 'meta_table' => null
public 'meta_id_column' => null
public 'primary_table' => null
public 'primary_id_column' => null
protected 'table_aliases' =>
array (size=0)
empty
protected 'clauses' =>
array (size=0)
empty
protected 'has_or_relation' => boolean false
public 'date_query' => boolean false
public 'request' => string 'SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (52,58,59,60,61,62,101)
) AND wp_posts.post_type = 'product' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10' (length=367)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment