Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCTransactionalEmailPostsManager::save_email_template_post_id
Saves the post ID for a specific email template type.
Метод класса: WCTransactionalEmailPostsManager{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WCTransactionalEmailPostsManager = new WCTransactionalEmailPostsManager(); $WCTransactionalEmailPostsManager->save_email_template_post_id( $email_type, $post_id );
- $email_type(строка) (обязательный)
- The type of email template e.g.
'customer_new_account'from the WC_Email->id property. - $post_id(int) (обязательный)
- The post ID to save.
Код WCTransactionalEmailPostsManager::save_email_template_post_id() WCTransactionalEmailPostsManager::save email template post id WC 11.2.2
public function save_email_template_post_id( $email_type, $post_id ) {
$option_name = $this->get_option_name( $email_type );
$previous_id = get_option( $option_name );
update_option( $option_name, $post_id );
// Invalidate caches for the previous mapping (if any).
if ( ! empty( $previous_id ) ) {
$this->invalidate_cache_for_template( (int) $previous_id, 'post_id' );
}
// Invalidate cache for the new post_id.
$this->invalidate_cache_for_template( $email_type, 'email_type' );
// Update in-memory caches with the new values.
$this->post_id_to_email_type_cache[ $post_id ] = $email_type;
wp_cache_set( $this->get_cache_key_for_post_id( $post_id ), $email_type, self::CACHE_GROUP, self::CACHE_EXPIRATION );
}