// This is only needed for the regular templates/template parts post type listing and editor.
if ( isset( $query['wp_id'
] ) ) { $wp_query_args['p'
] =
$query['wp_id'
];
} else { $wp_query_args['post_status'
] = 'publish';
} $template_query =
new WP_Query( $wp_query_args );
$query_result = array
();
foreach ( $template_query->posts
as $post ) { $template =
_build_block_template_result_from_post( $post );
if ( is_wp_error( $template ) ) { continue;
} if ( $post_type && !
$template->is_custom
) { continue;
} if ( $post_type &&