简体   繁体   中英

wp_query and get_posts return blank page

i am trying to display contents of a posttype when he storename is "NIKE" using both WP_QUERY and get_posts but it displays blank page

$args = array('post_type' => 'clothes','posts_per_page' => -1,
              'meta_query' => array(
                        array(
                                 'key' => 'storename',
                             'value' => 'NIKE',
                             'compare' => '='
                             )
                   )
              );

for wp_query i use

$loop = new WP_Query( $args );  

for get_posts i use

$loop=get_posts($args);

as soon as i put the line for $loop it returns blank page without the $loop th header etc is displayed. but not the content....just cant figure out how to display the content if both wp_query dont work...how to fix it.

when i change value from NIKE to something else say AMAZON it works fine. I can understand why its blocking particular value queries

Try to inscrease memory limit

Open wp-config.php

Place this code at very top of file.

ini_set('memory_limit', '256M');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM