Is there any way to get only the IDs of the posts in a query?
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Hello, is there any way to get only the IDs of the posts in a query? I need only list the IDs resulting from the main search so that I can execute a new custom query. Relevance has a function that does this.
global $ relevanssi_post_types;
$init_ids = $ relevanssi_post_types;
Is it possible to do something similar in wpsolr? Thank you
Yes, that’s it
WOW
I managed to make it work, thank you 😉
Here is my solution:
$post_ids = wp_list_pluck( $wp_query->posts, ‘ID’ );
print_r($post_ids);
You must be logged in to reply to this topic.