Skip to content

Commit 713c73c

Browse files
committed
Explicitly register comment meta in unit tests and revert the action hook back to init
1 parent 31d9ef9 commit 713c73c

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/wp-includes/comment.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4135,4 +4135,3 @@ function wp_create_initial_comment_meta() {
41354135
)
41364136
);
41374137
}
4138-
add_action( 'rest_api_init', 'wp_create_initial_comment_meta' );

src/wp-includes/default-filters.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
add_action( 'added_comment_meta', 'wp_cache_set_comments_last_changed' );
152152
add_action( 'updated_comment_meta', 'wp_cache_set_comments_last_changed' );
153153
add_action( 'deleted_comment_meta', 'wp_cache_set_comments_last_changed' );
154+
add_action( 'init', 'wp_create_initial_comment_meta' );
154155

155156
// Places to balance tags on input.
156157
foreach ( array( 'content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content' ) as $filter ) {

tests/phpunit/tests/rest-api/rest-comments-controller.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ public static function wpTearDownAfterClass() {
170170
public function set_up() {
171171
parent::set_up();
172172
$this->endpoint = new WP_REST_Comments_Controller();
173+
wp_create_initial_comment_meta();
174+
173175
if ( is_multisite() ) {
174176
update_site_option( 'site_admins', array( 'superadmin' ) );
175177
}

0 commit comments

Comments
 (0)