[WordPress] 外掛分享: Really Simple CSV Importer

WordPress 外掛 Really Simple CSV Importer 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Really Simple CSV Importer」是 2013-09-21 上架。
  • 目前有 40000 個安裝啟用數。
  • 上一次更新是 2017-11-28,距離現在已有 2712 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.6 以上版本才可以安裝。
  • 有 107 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

hissy |

外掛標籤

acf | cfs | csv | scf | importer |

內容簡介

替代 CSV 導入外掛程式。簡單而強大,最適合於技術狂熱者。

類別支援
標籤支援
自訂欄位支援
Smart Custom Fields 支援
Custom Field Suite 支援
Advanced Custom Fields 支援
自訂分類支援
自訂文章類型支援
測試執行前的過濾器勾子
在匯入到資料庫之前自訂 CSV 資料的過濾器勾子
在匯入到資料庫後更新文章資料的操作勾子

您可以在 /wp-content/plugins/really-simple-csv-importer/sample 目錄中找到範例 CSV 檔案。

可用的欄位名稱和值:

ID 或 post_id:(int)文章 ID。
此值不是必需的。文章 ID 已存在於您的部落格中,匯入程式將更新該文章資料。若該 ID 不存在,匯入程式將嘗試建立具有建議 ID 的新文章。
post_author:(登入或 ID)作者的使用者名稱或使用者 ID。
post_date:(string)發布日期的時間。
post_content:(string)文章的完整內容。
post_title:(string)文章的標題。
post_excerpt:(string)您的文章摘要的需求。
post_status:('draft' 或 'publish' 或 'pending' 或 'future' 或 'private' 或自訂註冊狀態)文章的狀態。預設為 'draft'。
post_password:(string)保護文章的密碼。密碼限於 20 個字元。
post_name:(string)文章的 slug。
post_parent:(int)文章的父代 ID。用於頁面或分層文章類型。
menu_order:(int)
post_type:('post' 或 'page' 或任何其他文章類型名稱)(必需)文章類型的 slug,不是標籤。
post_thumbnail:(string)文章縮略圖的 URI 或路徑。
例如。http://example.com/example.jpg 或 /path/to/example.jpg
post_category:(string,逗號分隔)文章類別的 slug
post_tags:(string,逗號分隔)文章標記的名稱
tax_{taxonomy}:(string,逗號分隔)任何以 tax_ 為前綴的欄位都將用作自訂分類。分類必須已經存在。條目是術語的名稱或 slug。
{custom_field_key}:(string)任何其他用作自訂欄位的欄位標籤
cfs_{field_name}:(string)如果要將資料匯入到由 Custom Field Suite 設置的自訂欄位,請將前綴 cfs_ 添加到列標頭名稱。
scf_{field_name}:(string)如果要將資料匯入到由 Smart Custom Fields 設置的自訂欄位,請將前綴 scf_ 添加到列標頭名稱。
comment_status:('closed' 或 'open')預設為選項 'default_comment_status' 或 'closed'。

註:CSV 文件中的空格表示「保留」,而不是「刪除」。
註:如果要設置某個頁面的頁面範本,請使用名稱為 _wp_page_template 的自訂欄位鍵。
註:如果提供了值為 'future' 的 post_status,則必須指定 post_date,以便 WordPress 能夠正確設定日期。

原文外掛簡介

Alternative CSV Importer plugin. Simple and powerful, best for geeks.

Category support
Tag support
Custom field support
Smart Custom Fields support
Custom Field Suite support
Advanced Custom Fields support
Custom Taxonomy support
Custom Post Type support
Filter hook for dry-run-testing
Filter hooks for customize csv data before importing to database
Action hook for update post data after importing to database

You can get example CSV files in /wp-content/plugins/really-simple-csv-importer/sample directory.
Available column names and values:

ID or post_id: (int) post id.
This value is not required. The post ID is already exists in your blog, importer will update that post data. If the ID is not exists, importer will trying to create a new post with suggested ID.
post_author: (login or ID) The user name or user ID number of the author.
post_date: (string) The time of publish date.
post_content: (string) The full text of the post.
post_title: (string) The title of the post.
post_excerpt: (string) For all your post excerpt needs.
post_status: (‘draft’ or ‘publish’ or ‘pending’ or ‘future’ or ‘private’ or custom registered status) The status of the post. ‘draft’ is default.
post_password: (string) The password to protect the post. The password is limited to 20 characters.
post_name: (string) The slug of the post.
post_parent: (int) The post parent id. Used for page or hierarchical post type.
menu_order: (int)
post_type: (‘post’ or ‘page’ or any other post type name) (required) The post type slug, not labels.
post_thumbnail: (string) The uri or path of the post thumbnail.
E.g. http://example.com/example.jpg or /path/to/example.jpg
post_category: (string, comma separated) slug of post categories
post_tags: (string, comma separated) name of post tags
tax_{taxonomy}: (string, comma separated) Any field prefixed with tax_ will be used as a custom taxonomy. Taxonomy must already exist. Entries are names or slugs of terms.
{custom_field_key}: (string) Any other column labels used as custom field
cfs_{field_name}: (string) If you would like to import data to custom fields set by Custom Field Suite, please add prefix cfs_ to column header name.
scf_{field_name}: (string) If you would like to import data to custom fields set by Smart Custom Fields, please add prefix scf_ to column header name.
comment_status: (‘closed’ or ‘open’) Default is the option ‘default_comment_status’, or ‘closed’.

Note: Empty cells in the csv file means “keep it”, not “delete it”.
Note: To set the page template of a page, use custom field key of _wp_page_template.
Note: If providing a post_status of ‘future’ you must specify the post_date in order for WordPress to know when to publish your post.
Note: If the post_type value is attachment, you can use post_thumbnail field to define media URL or path.
Advanced Custom Fields plugin integrate
If advanced custom field key is exists, importer will trying to use update_field function instead of built-in add_post_meta function.
How to find advanced custom field key: Finding the field key
Official public repository
Add star and read future issues about rs-csv-importer on GitHub!
Thanks
Cover banner designed by @luchino__
How to debug import data
Really Simple CSV Importer Debugger add-on enables you to dry-run-testing and show more detailed post, meta, taxonomy data of each csv row.
Download from gist.
How to customize import post data
There are three filters available in the importer.
really_simple_csv_importer_save_post
This filter is applied to post data.
Parameters:

$post – (array)(required) post data
$is_update – (bool) update existing post data, or insert new post data

Example:
function really_simple_csv_importer_save_post_filter( $post, $is_update ) {

// remove specific tag from import data
if (isset($post['post_tags'])) {
$_tags = array();
foreach ($post['post_tags'] as $tag) {
if ($tag != 'Apple') {
$_tags[] = $tag;
}
}
$post['post_tags'] = $_tags;
}

return $post;
}
add_filter( 'really_simple_csv_importer_save_post', 'really_simple_csv_importer_save_post_filter', 10, 2 );

really_simple_csv_importer_save_meta
This filter is applied to post meta data.
Parameters:

$meta – (array)(required) post meta data
$post – (array) post data
$is_update – (bool)

Example:
function really_simple_csv_importer_save_meta_filter( $meta, $post, $is_update ) {

// serialize metadata
$meta_array = array();
if (isset($meta['meta_key_1'])) $meta_array[] = $meta['meta_key_1'];
if (isset($meta['meta_key_2'])) $meta_array[] = $meta['meta_key_2'];
$meta = array( 'meta_key' => $meta_array );

return $meta;
}
add_filter( 'really_simple_csv_importer_save_meta', 'really_simple_csv_importer_save_meta_filter', 10, 3 );

really_simple_csv_importer_save_tax
This filter is applied to post taxonomy data (categories and tags are not included, these are post data).
Parameters:

$tax – (array)(required) post taxonomy data
$post – (array) post data
$is_update – (bool)

Example:
function really_simple_csv_importer_save_tax_filter( $tax, $post, $is_update ) {

// Fix misspelled taxonomy
if (isset($tax['actors'])) {
$_actors = array();
foreach ($tax['actors'] as $actor) {
if ($actor == 'Johnny Dep') {
$actor = 'Johnny Depp';
}
$_actors[] = $actor;
}
$tax['actors'] = $_actors;
}

return $tax;
}
add_filter( 'really_simple_csv_importer_save_tax', 'really_simple_csv_importer_save_tax_filter', 10, 3 );

really_simple_csv_importer_save_thumbnail
This filter is applied to thumbnail data.
Parameters:

$post_thumbnail – (string)(required) the thumbnail file path or distant URL
$post – (array) post data
$is_update – (bool)

Example:
function really_simple_csv_importer_save_thumbnail_filter( $post_thumbnail, $post, $is_update ) {

// Import a local file from an FTP directory
if (!empty($post_thumbnail) && file_exists($post_thumbnail)) {
$upload_dir = wp_upload_dir();
$target_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . basename($post_thumbnail);
if (copy($post_thumbnail, $target_path)) {
$post_thumbnail = $target_path;
}
}

return $post_thumbnail;
}
add_filter( 'really_simple_csv_importer_save_thumbnail', 'really_simple_csv_importer_save_thumbnail_filter', 10, 3 );

How to customize the post data after importing to database
really_simple_csv_importer_post_saved
This action provides availability to run some tasks after importing.
Example: Download image from remote url to custom field (Download from gist)
How to customize the importing process entirely
really_simple_csv_importer_class
This filter provides availability to completely replace the RS_CSV_Importer#save_post method.
Example: Update row based on a custom field ID/key match (Download from gist)

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Really Simple CSV Importer」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 1.0 | 1.1 | 1.2 | 0.1.1 | 0.4.1 | 0.4.2 | 0.5.1 | 0.5.2 | 0.5.3 | 0.5.4 | 0.5.5 | 0.5.6 | 0.6.2 | 0.6.3 |

延伸相關外掛(你可能也想知道)

  • WordPress Importer 》WordPress Importer 可以從 WordPress 匯出檔案中導入以下內容:, , 文章、頁面和其他自定義文章類型, 評論和評論元數據, 自定義欄位和文章元數據, 來自自定...。
  • Widget Importer & Exporter 》Widget Importer & Exporter 是一個有用的外掛,可將小工具從一個WordPress站點移動到另一個站點,備份小工具,並供主題開發人員為用戶提供範例小工具。...。
  • ThemeGrill Demo Importer 》透過這個外掛,只需點選一下按鈕,即可匯入 ThemeGrill 官方主題的示範內容、小工具和主題設定。, 享有免費支援。, 注意事項, , 此外掛會遠端呼叫我們的 Clou...。
  • Import and export users and customers 》在您的免費測試網站中試試看:點擊此處 => https://demo.tastewp.com/import-users-from-csv-with-meta, 一個乾淨易用的用戶和客戶導入/導出外掛,適用於 ...。
  • Blogger Importer 》Blogger Importer 是一個 WordPress.org 外掛,可以將 Google Blogger 網站的部落格資料匯入到 WordPress.org 的網站上。, 匯入的內容, , 分類, 文章(已發佈...。
  • Categories to Tags Converter 》這個外掛可以有選擇地將現有的 WordPress 分類或標籤相互轉換。。
  • RSS Importer 》從 RSS 訂閱中匯入文章。。
  • Movable Type and TypePad Importer 》此外掛可以從 Movable Type 或 TypePad 部落格匯入文章及評論。。
  • Ansar Import 》匯入Themeansar官方主題的示範內容, 需求, , WordPress 4.7或更高版本, Themeansar主題, 。
  • Mystery Themes Demo Importer 》透過單一點擊,即可匯入「Mystery Themes」的所有官方主題。安裝及啟用所有必需的外掛程式非常簡單。以簡單方式匯入所有官方主題的自訂選項、佈景主題設定及...。
  • LiveJournal Importer 》這是一個簡單的匯入工具,可將您的 LiveJournal 匯入 WordPress。。
  • Icyclub 》針對所有 Themeansar 主題的 Icyclub WordPress 外掛, Icyclub 外掛的功能包括:, , 美觀的預建首頁配置, 拖放式頁面自訂, 預定義的實用區段, 即時內容編輯, ...。
  • Sparkle Demo Importer 》首頁 | 文件 | 付費版 | 所有主題 | 外掛 | 部落格, , Sparkle Demo Importer 可以在點擊一下的情況下匯入 SparkleThemes 的完整主題演示。這個外掛專門為了...。
  • WP Options Importer 》目前 WordPress 可透過 WXR 匯出其所有內容,然後再透過 WordPress, 匯入外掛進行導入。這個過程包括所有文章、術語、選單、評論和使用者,, 但不碰觸選項。...。
  • WPML to Polylang 》特色, , 匯入語言和 WPML 選項(當相同選項存在於 Polylang 中時)。, 匯入文章和詞語的語言以及翻譯(包括自訂文章類型和自訂分類法)。, 匯入多語言導覽選...。

文章
Filter
Apply Filters
Mastodon