WordPress | WP_Query('s=a') returns nothing -
i have following code:
$data = new wp_query('s=a');
and print_r returns following data:
wp_query object ( [query_vars] => array ( [s] => [error] => [m] => 0 [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => [meta_value] => [preview] => [sentence] => [fields] => [menu_order] => [category__in] => array ( ) [category__not_in] => array ( ) [category__and] => array ( ) [post__in] => array ( ) [post__not_in] => array ( ) [tag__in] => array ( ) [tag__not_in] => array ( ) [tag__and] => array ( ) [tag_slug__in] => array ( ) [tag_slug__and] => array ( ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [update_post_meta_cache] => 1 [post_type] => [posts_per_page] => 10 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [search_terms] => array ( [0] => ) [order] => desc ) [tax_query] => wp_tax_query object ( [queries] => array ( ) [relation] => , ) [meta_query] => wp_meta_query object ( [queries] => array ( ) [relation] => ) [post_count] => 0 [current_post] => -1 [in_the_loop] => [comment_count] => 0 [current_comment] => -1 [found_posts] => 0 [max_num_pages] => 0 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] => [is_search] => 1 [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => [is_404] => [is_comments_popup] => [is_paged] => [is_admin] => [is_attachment] => [is_singular] => [is_robots] => [is_posts_page] => [is_post_type_archive] => [query_vars_hash] => 1015947de489d0153582586bded7c016 [query_vars_changed] => [thumbnails_cached] => [query] => array ( [s] => ) [request] => select * wp_posts 1=2 [posts] => array ( ) )
what wrong query , not return data ? take @ "requer" "select * wp_posts 1=2"
i ran in exact same problem. case turned out due relevanssi search plugin.
i found this in relevanssi support forums.
add theme's functions.php
or somehere in plugin.
add_filter('relevanssi_prevent_default_request', 'rlv_fix_archive_kill', 10, 2); function rlv_fix_archive_kill($kill, $query) { if (empty($query->query_vars['s'])) $kill = false; return $kill; }
Comments
Post a Comment