WP_REST_Comments_Controller::check_post_type_supports_notesprivateWP 1.0

Check if post type supports notes.

Method of the class: WP_REST_Comments_Controller{}

No Hooks.

Returns

true|false. True if post type supports notes, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->check_post_type_supports_notes( $post_type );
$post_type(string) (required)
Post type name.

WP_REST_Comments_Controller::check_post_type_supports_notes() code WP 6.9.1

private function check_post_type_supports_notes( $post_type ) {
	$supports = get_all_post_type_supports( $post_type );
	if ( ! isset( $supports['editor'] ) ) {
		return false;
	}
	if ( ! is_array( $supports['editor'] ) ) {
		return false;
	}
	foreach ( $supports['editor'] as $item ) {
		if ( ! empty( $item['notes'] ) ) {
			return true;
		}
	}
	return false;
}