admin管理员组文章数量:1130349
I'm developing an website that I didn't built the foundation for. When I try to implement a simple search query I just get nothing in response. There is no errors showing up in normal php error reporting. The only thing showing is complete blank result. If I turn on debug.log I don't get any returns from WP.
This is the code i'm running:
$args = array(
's' => 'test',
'post_type' => 'posts'
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
//inside the loop
the_title();
the_content();
endwhile;
// Reset Post Data
wp_reset_postdata();
If I run it without the 's' => 'test', parameter I get results returned. I tried different post types, different search queries etc... Everything works as soon as I remove the s parameter.
I run the query on a custom post type single page.
What could be the problem? And how do I debug it? Can't find any clue to what is wrong.
I'm developing an website that I didn't built the foundation for. When I try to implement a simple search query I just get nothing in response. There is no errors showing up in normal php error reporting. The only thing showing is complete blank result. If I turn on debug.log I don't get any returns from WP.
This is the code i'm running:
$args = array(
's' => 'test',
'post_type' => 'posts'
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
//inside the loop
the_title();
the_content();
endwhile;
// Reset Post Data
wp_reset_postdata();
If I run it without the 's' => 'test', parameter I get results returned. I tried different post types, different search queries etc... Everything works as soon as I remove the s parameter.
I run the query on a custom post type single page.
What could be the problem? And how do I debug it? Can't find any clue to what is wrong.
本文标签: How to debug none working search query
版权声明:本文标题:How to debug none working search query? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749088289a2314118.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论