Skip to content

Commit ebf617c

Browse files
authored
Add init check to get_comment_type_slugs (#2237)
1 parent 5616349 commit ebf617c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

includes/class-comment.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,12 @@ public static function is_registered_comment_type( $slug ) {
560560
* @return array The registered custom comment type slugs.
561561
*/
562562
public static function get_comment_type_slugs() {
563+
if ( ! did_action( 'init' ) ) {
564+
_doing_it_wrong( __METHOD__, 'This function should not be called before the init action has run. Comment types are only available after init.', 'unreleased' );
565+
566+
return array();
567+
}
568+
563569
return array_keys( self::get_comment_types() );
564570
}
565571

0 commit comments

Comments
 (0)