我想我对自己的问题有了答案。将数据加载到wp_woocommerce_attribute_taxonomies
作为上述函数的一部分,有必要创建属性及其元数据的序列化数组,并将其发布到wp_options
.据我所知wp_options
包含wordpress用来提高性能的一系列瞬态数据。
下面的查询似乎可以做到这一点。
/*
ATTRIBUTES
---------------
Post an entry into wp_options
option_name = "_transient_wc_attribute_taxonomies"
This record is used to populate the ADMIN AREA -> Products -> Attributes interface
.. and appears to be used to post attribute values to screen in the web -> products list pages
*/
SET SESSION group_concat_max_len=10000;
SET @RowNo = -1;
INSERT INTO `wp_options` (`option_name`,`option_value`, `autoload`)
SELECT * FROM
(
SELECT
"_transient_wc_attribute_taxonomies" AS `New_Option_Name`,
CONCAT("a:",COUNT(*),":{",
GROUP_CONCAT(option_value SEPARATOR ""),
"}") AS New_Option_Value, "yes" AS `New_Autoload`
FROM
(
SELECT
CONCAT(
"i:",(@RowNo := @RowNo + 1),";O:8:","""","stdclass","""",":6:"
,"{S:12:","""","attribute_id","""",";s:",LENGTH(attribute_id),":","""",attribute_id,"""",";"
,"S:14:","""","attribute_name","""",";s:",LENGTH(attribute_name),":","""",attribute_name,"""",";"
,"S:15:","""","attribute_label","""",";s:",LENGTH(attribute_label),":","""",attribute_label,"""",";"
,"S:14:","""","attribute_type","""",";s:",LENGTH(attribute_type),":","""",attribute_type,"""",";"
,"S:17:","""","attribute_orderby","""",";s:",LENGTH(attribute_orderby),":","""",attribute_orderby,"""",";"
,"S:16:","""","attribute_public","""",";s:",LENGTH(attribute_public),":","""",attribute_public,"""",";}"
) AS option_value
FROM `wp_woocommerce_attribute_taxonomies`
) Calculated_values
) Formatted_Values
ON DUPLICATE KEY UPDATE option_value = Formatted_Values.New_Option_Value;