[wordpress插件] Deserialize Metadata反序列化元数据

wordpress 插件 文章 2020-04-15 20:20 458 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

When migrating from another system (i.e. Drupal), WordPress can require data that is currently serialized to be unserialized and stored in its own WordPress-specific tables/columns.

从另一个系统(即Drupal)迁移时,WordPress可能要求将当前序列化的数据进行非序列化并存储在其自己的WordPress特定表/列中。

This plugin can look for such data, and deserialize and store it, based on the plugin settings.

该插件可以根据插件设置查找此类数据,并反序列化并存储它。

This plugin handles one (configurable) imported field at a time, so all imported, serialized data needs to be stored in that single field.

此插件一次处理一个(可配置)导入字段,因此所有导入的序列化数据都需要存储在该单个字段中。

Each key in that field can be mapped to any column, and stored in either wp_postmeta or wp_posts, as shown below:

该字段中的每个键都可以映射到任何列,并存储在 wp_postmeta wp_posts 中,如下所示:

`

 `

if ( $maps[$key][‘wp_table’] === ‘wp_postmeta’ && $value != ” && $value != NULL ) {
    

if($ maps [$ key] ['wp_table'] ===‘wp_postmeta'&& $ value!=” && $ value!= NULL){
    

add_post_meta( $post_id, $maps[$key][‘wp_column’], $value, $maps[$key][‘unique’] );

add_post_meta($ post_id,$ maps [$ key] ['wp_column'],$ value,$ maps [$ key] ['unique']);

} else if ( $maps[$key][‘wp_table’] === ‘wp_posts’ && $value != ” && $value != NULL ) {
    

}否则if($ maps [$ key] ['wp_table'] ===‘wp_posts'&& $ value!=” && $ value!= NULL){
    

$post = array(
        

$ post = array(
        

‘ID’ => $post_id,
        

‘ID’=> $ post_id,
        

$maps[$key][‘wp_column’] => $value
    

$ maps [$ key] [‘wp_column’] => $ value
    

);
    

);
    

wp_update_post( $post );

wp_update_post($ post);

}
    

}
    

`

`

The wp_schedule_event method is used to deserialize the data and place it into its appropriate fields, and it can run at any configurable interval (you pick a number, and then a unit of time).<

wp_schedule_event 方法用于反序列化数据并将其放入其适当的字段中,并且它可以按任何可配置的时间间隔运行(您选择一个数字,然后选择一个时间单位)。

/p>

/ p>

安装步骤

    1. Upload the deserialize-metadata folder to the /wp-content/plugins/ directory
    2. deserialize-metadata 文件夹上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Fill out the settings on the Deserialize Metadata subpage of the Settings menu
    6. 填写“设置”菜单中“反序列化元数据”子页面上的设置

下载地址
https://downloads.wordpress.org/plugin/deserialize-metadata.0.0.8.zip
-EOF-

AI助手支持GPT4.0