Automattic\WooCommerce\Internal\EmailEditor

Integration::add_email_post_typepublicWC 1.0

Add WooCommerce email post type to the list of supported post types.

Method of the class: Integration{}

No Hooks.

Returns

Array. Modified list of post types.

Usage

$Integration = new Integration();
$Integration->add_email_post_type( $post_types ): array;
$post_types(array) (required)
List of post types.

Integration::add_email_post_type() code WC 10.3.6

public function add_email_post_type( array $post_types ): array {
	$post_types[] = array(
		'name' => self::EMAIL_POST_TYPE,
		'args' => array(
			'labels'          => array(
				'name'          => __( 'Emails', 'woocommerce' ),
				'singular_name' => __( 'Email', 'woocommerce' ),
				'add_new_item'  => __( 'Add Email', 'woocommerce' ),
				'edit_item'     => __( 'Edit Email', 'woocommerce' ),
				'new_item'      => __( 'New Email', 'woocommerce' ),
				'view_item'     => __( 'View Email', 'woocommerce' ),
				'search_items'  => __( 'Search Emails', 'woocommerce' ),
			),
			'rewrite'         => array( 'slug' => self::EMAIL_POST_TYPE ),
			'supports'        => array(
				'title',
				'editor' => array(
					'default-mode' => 'template-locked',
				),
				'excerpt',
			),
			'capability_type' => self::EMAIL_POST_TYPE,
			'capabilities'    => array(
				'edit_post'          => 'manage_woocommerce',
				'read_post'          => 'manage_woocommerce',
				'delete_post'        => 'manage_woocommerce',
				'edit_posts'         => 'manage_woocommerce',
				'edit_others_posts'  => 'manage_woocommerce',
				'delete_posts'       => 'manage_woocommerce',
				'publish_posts'      => 'manage_woocommerce',
				'read_private_posts' => 'manage_woocommerce',
				'create_posts'       => 'manage_woocommerce',
			),
			'map_meta_cap'    => false,
		),
	);
	return $post_types;
}