简体   繁体   English

wp_query和get_posts返回空白页

[英]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 我试图同时使用WP_QUERY和get_posts显示他的商店名称为“ NIKE”时的邮政类型的内容,但它显示空白页

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

for wp_query i use 对于wp_query我使用

$loop = new WP_Query( $args );  

for get_posts i use 对于我使用的get_posts

$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. 一旦我将$loop行放入,它就会返回空白页,而不会显示$loop th标头等。 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. 当我将NIKE的值更改为AMAZON时,它可以正常工作。 I can understand why its blocking particular value queries 我能理解为什么它阻止了特定的值查询

Try to inscrease memory limit 尝试增加内存限制

Open wp-config.php 打开wp-config.php

Place this code at very top of file. 将此代码放在文件的最顶部。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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