From fa738180f4c6d946461474cfa905ed8f8c82110f Mon Sep 17 00:00:00 2001 From: Sukhendu Sekhar Guria Date: Fri, 8 May 2026 14:49:54 +0530 Subject: [PATCH 1/2] fix: show non-public CPT labels in find posts --- src/wp-admin/includes/ajax-actions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 2af08fba70af9..a6ef08cd5690c 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2248,6 +2248,14 @@ function wp_ajax_find_posts() { check_ajax_referer( 'find-posts' ); $post_types = get_post_types( array( 'public' => true ), 'objects' ); + + // Include non-public, non-built-in post types with an admin UI that the current user can access. + foreach ( get_post_types( array( 'public' => false, 'show_ui' => true ), 'objects' ) as $slug => $post_type_obj ) { + if ( ! $post_type_obj->_builtin && current_user_can( $post_type_obj->cap->edit_posts ) ) { + $post_types[ $slug ] = $post_type_obj; + } + } + unset( $post_types['attachment'] ); $args = array( From 729cf67b692c08362091b834e9e60c0cff51977c Mon Sep 17 00:00:00 2001 From: Sukhendu Sekhar Guria Date: Fri, 8 May 2026 14:53:05 +0530 Subject: [PATCH 2/2] Fix PHPCS errors --- src/wp-admin/includes/ajax-actions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index a6ef08cd5690c..4870de799e297 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2250,7 +2250,13 @@ function wp_ajax_find_posts() { $post_types = get_post_types( array( 'public' => true ), 'objects' ); // Include non-public, non-built-in post types with an admin UI that the current user can access. - foreach ( get_post_types( array( 'public' => false, 'show_ui' => true ), 'objects' ) as $slug => $post_type_obj ) { + foreach ( get_post_types( + array( + 'public' => false, + 'show_ui' => true, + ), + 'objects' + ) as $slug => $post_type_obj ) { if ( ! $post_type_obj->_builtin && current_user_can( $post_type_obj->cap->edit_posts ) ) { $post_types[ $slug ] = $post_type_obj; }