Issue with returning Field IDs not working
-
Hi,
I’m trying to debug an issue with a custom Relevanssi search form where setting'fields' => 'ids'
is not working.The following code simply searches for a movie post type by term. You can see in the comments where things are getting messy.
$args = array( 'post_type' => array('movie'), 'fields' => 'ids', 's' => $term, ); $wp_query = new WP_Query($args); // print_r($wp_query->posts) // Returns array of post IDs [PERFECT!] relevanssi_do_query($wp_query); // print_r($wp_query->posts); // Returns a WP_POST Object array [BOO!] // Parse the query //... Code removed, not needed for this example.
After the
relevanssi_do_query
function is run, the array of posts is no longer just post IDs but has been converted to a WP_POST object.I dug into the plugin and confirmed
ids
is the value of thefields
param in the search() method.Any ideas why this would be happening?
Cheers and thanks in advance!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Issue with returning Field IDs not working’ is closed to new replies.