Support » Plugin: Beautiful taxonomy filters » Get the ids of the resulting posts

  • Resolved hwuser


    Hello, thank you very much for the plugin.

    Is there any way or function so that once the filter is applied, you can get the ids of the resulting posts, which will be displayed on the new page, to be able to use them for something else in add_filter (‘the_content’?


    • This topic was modified 6 months ago by  hwuser.
Viewing 1 replies (of 1 total)
  • Plugin Author Jonathandejong


    Hi Sergio,

    The filtered posts are the core WP_Query.

    So if you for example want to create your own array of just post IDs you could do something like:

    global $wp_query;
    $post_ids = [];
    if ( ! empty( $wp_query->posts ) ) {
    	$post_ids = array_map(
    		function( $a_post ) {
    			return $a_post->ID;
    // Will contain an array of post ids. [ 1, 2, 3, 4, …]
    var_dump( $post_ids );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.