diff --git a/lib/compat/wordpress-6.7/rest-api.php b/lib/compat/wordpress-6.7/rest-api.php index aa3f4c2fc42da..475f92f965c93 100644 --- a/lib/compat/wordpress-6.7/rest-api.php +++ b/lib/compat/wordpress-6.7/rest-api.php @@ -156,3 +156,22 @@ function update_get_avatar_comment_type( $comment_type ) { } add_filter( 'get_avatar_comment_types', 'update_get_avatar_comment_type', 10, 1 ); } + +/** + * Updates the comment type filter dropdown options. + * + * This function is only defined if the 'gutenberg-block-comment' experiment is enabled and the 'update_comment_type_filter_dropdown' function does not already exist. + * It returns an array of comment type options for the comment type filter dropdown in the admin area. + * + * @return array An associative array of comment type options. + * The keys are the comment type slugs and the values are the translated names of the comment types. + */ +if ( ! function_exists( 'update_comment_type_filter_dropdown' ) && gutenberg_is_experiment_enabled( 'gutenberg-block-comment' ) ) { + function update_comment_type_filter_dropdown() { + return array( + 'comment' => __( 'Comments' ), + 'block_comment' => __( 'Block Comments' ), + ); + } + add_filter( 'admin_comment_types_dropdown', 'update_comment_type_filter_dropdown' ); +}