Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailPostsCleanup::fetch_email_post_mappings
Fetch all email type → post ID option mappings straight from the database.
Bypasses the posts manager caches on purpose: this is a migration and must observe the persisted state.
Метод класса: WCEmailPostsCleanup{}
Хуков нет.
Возвращает
\stdClass[]. Rows with option_name and option_value.
Использование
$result = WCEmailPostsCleanup::fetch_email_post_mappings(): array;
Код WCEmailPostsCleanup::fetch_email_post_mappings() WCEmailPostsCleanup::fetch email post mappings WC 11.2.2
private static function fetch_email_post_mappings(): array {
global $wpdb;
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$rows = $wpdb->get_results(
$wpdb->prepare(
"SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE %s ORDER BY option_name ASC",
WCTransactionalEmailPostsManager::WC_OPTION_NAME
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
return is_array( $rows ) ? $rows : array();
}