From deeca51a9776846f5186973089a3a62b8242813a Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 14 Dec 2022 18:42:22 +0530 Subject: [PATCH 1/2] add filter for selected posts arguments --- includes/classes/NS_Post_Finder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/classes/NS_Post_Finder.php b/includes/classes/NS_Post_Finder.php index 514b2e1..442a5f2 100644 --- a/includes/classes/NS_Post_Finder.php +++ b/includes/classes/NS_Post_Finder.php @@ -282,7 +282,7 @@ public static function render( $name, $value, $options = array() ) { if ( ! empty( $value ) && is_string( $value ) ) { $post_ids = array_map( 'intval', explode( ',', $value ) ); - $posts = new WP_Query( array( + $selected_posts_args = apply_filters( 'post_finder_selected_posts_args' ,array( 'post_type' => $args['post_type'], 'post_status' => $args['post_status'], 'post__in' => $post_ids, @@ -291,6 +291,7 @@ public static function render( $name, $value, $options = array() ) { 'posts_per_page' => count( $post_ids ), ) ); + $posts = new WP_Query( $selected_posts_args ); $posts = $posts->have_posts() ? $posts->posts : array(); wp_reset_postdata(); } else { From b7c5f395af7a48f57484f018b967c53a5be38bb0 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 14 Dec 2022 18:46:17 +0530 Subject: [PATCH 2/2] minor change in spacing --- includes/classes/NS_Post_Finder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/classes/NS_Post_Finder.php b/includes/classes/NS_Post_Finder.php index 442a5f2..a2b5c3b 100644 --- a/includes/classes/NS_Post_Finder.php +++ b/includes/classes/NS_Post_Finder.php @@ -282,7 +282,7 @@ public static function render( $name, $value, $options = array() ) { if ( ! empty( $value ) && is_string( $value ) ) { $post_ids = array_map( 'intval', explode( ',', $value ) ); - $selected_posts_args = apply_filters( 'post_finder_selected_posts_args' ,array( + $selected_posts_args = apply_filters( 'post_finder_selected_posts_args', array( 'post_type' => $args['post_type'], 'post_status' => $args['post_status'], 'post__in' => $post_ids,