
內容簡介
這個外掛程式可以按照每篇文章類型將文章匯出為 CSV 格式。
此外,它也支援文章的自訂欄位和自訂分類法。
您還可以設定要下載的文章數量或日期範圍。
如何自訂匯出的文章數據
此外掛有以下篩選器。
wp_csv_exporter_post_name - 文章名稱
wp_csv_exporter_post_title - 文章標題
wp_csv_exporter_post_content - 文章內容
wp_csv_exporter_post_excerpt - 文章摘要
wp_csv_exporter_post_status - 文章狀態
wp_csv_exporter_post_author - 文章作者
wp_csv_exporter_post_date - 文章日期
wp_csv_exporter_post_modified - 文章修改日期
wp_csv_exporter_thumbnail_url - 文章縮圖 URL
wp_csv_exporter_post_tags - 文章標籤
wp_csv_exporter_post_category - 文章類別
wp_csv_exporter_tax_{taxonomy} - 自訂分類法
wp_csv_exporter_{custom_field_key} - 自訂欄位
wp_csv_exporter_post_name
參數:
$post_name – (必要) 文章 URL
$post_id – (int) 文章 ID
例如:
add_filter( 'wp_csv_exporter_post_name', 'wp_csv_exporter_post_name_filter', 10, 3 );
function wp_csv_exporter_post_name_filter( $post_name, $post_id ) {
return $post_name;
}
wp_csv_exporter_post_title
參數:
$post_title – (必要) 文章標題
$post_id – (int) 文章 ID
例如:
add_filter( 'wp_csv_exporter_post_title', 'wp_csv_exporter_post_title_filter', 10, 3 );
function wp_csv_exporter_post_title_filter( $post_title, $post_id ) {
$post_title = $post_id . ':' . $post_title;
return $post_title;
}
wp_csv_exporter_post_content
參數:
$post_content – (必要) 文章內容
$post_id – (int) 文章 ID
wp_csv_exporter_post_excerpt
參數:
$post_excerpt – (必要) 文章摘要
$post_id – (int) 文章 ID
wp_csv_exporter_post_status
參數:
$post_status – (必要) 文章狀態
$post_id – (int) 文章 ID
wp_csv_exporter_post_author
參數:
$post_author – (必要) 文章作者
$post_id – (int) 文章 ID
wp_csv_exporter_post_date
參數:
$post_date – (必要) 文章日期
$post_id – (int) 文章 ID
wp_csv_exporter_post_modified
參數:
$post_modified – (必要) 文章修改日期
$post_id – (int) 文章 ID
wp_csv_exporter_post_thumbnail_url
參數:
$post_thumbnail_url – (必要) 文章縮圖 URL
$post_id – (int) 文章 ID
wp_csv_exporter_post_tags
參數:
$post_tags – (array)(必要) 文章標籤
$post_id – (int) 文章 ID
例如:
add_filter( 'wp_csv_exporter_post_tags', 'wp_csv_exporter_post_tags_filter', 10, 3 );
function wp_csv_exporter_post_tags_filter( $post_tags, $post_id ) {
$_post_tags = array();
foreach ( $post_tags as $tag ) {
$_post_tags[] = $tag->name;
}
return implode( ',', $_post_tags );
}
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
You can export posts in CSV format for each post type.
It is compatible with posts’ custom fields and custom taxonomies.
It is also possible to set the number or date range of posts to download.
How to customize export post data
This plugin has below filters.
wp_csv_exporter_post_name
wp_csv_exporter_post_title
wp_csv_exporter_post_content
wp_csv_exporter_post_excerpt
wp_csv_exporter_post_status
wp_csv_exporter_post_author
wp_csv_exporter_post_date
wp_csv_exporter_post_modified
wp_csv_exporter_thumbnail_url
wp_csv_exporter_post_tags
wp_csv_exporter_post_category
wp_csv_exporter_tax_{taxonomy}
wp_csv_exporter_{custom_field_key}
wp_csv_exporter_post_name
Parameters:
$post_name – (required) post slug
$post_id – (int) post id
Example:
add_filter( 'wp_csv_exporter_post_name', 'wp_csv_exporter_post_name_filter', 10, 3 );
function wp_csv_exporter_post_name_filter( $post_name, $post_id ) {
return $post_name;
}
wp_csv_exporter_post_title
Parameters:
$post_title – (required) post title
$post_id – (int) post id
Example:
add_filter( 'wp_csv_exporter_post_title', 'wp_csv_exporter_post_title_filter', 10, 3 );
function wp_csv_exporter_post_title_filter( $post_title, $post_id ) {
$post_title = $post_id . ':' . $post_title;
return $post_title;
}
wp_csv_exporter_post_content
Parameters:
$post_content – (required) post content
$post_id – (int) post id
wp_csv_exporter_post_excerpt
Parameters:
$post_excerpt – (required) post excerpt
$post_id – (int) post id
wp_csv_exporter_post_status
Parameters:
$post_status – (required) post status
$post_id – (int) post id
wp_csv_exporter_post_author
Parameters:
$post_author – (required) post author
$post_id – (int) post id
wp_csv_exporter_post_date
Parameters:
$post_date – (required) post date
$post_id – (int) post id
wp_csv_exporter_post_modified
Parameters:
$post_modified – (required) post modified date
$post_id – (int) post id
wp_csv_exporter_post_thumbnail_url
Parameters:
$post_thumbnail_url – (required) post thumbnail_url
$post_id – (int) post id
wp_csv_exporter_post_tags
Parameters:
$post_tags – (array)(required) post tags
$post_id – (int) post id
Example:
add_filter( 'wp_csv_exporter_post_tags', 'wp_csv_exporter_post_tags_filter', 10, 3 );
function wp_csv_exporter_post_tags_filter( $post_tags, $post_id ) {
$_post_tags = array();
foreach ( $post_tags as $key => $tag ) {
$_post_tags[] = 'Tag:'.$tag;
}
return $_post_tags;
}
wp_csv_exporter_category
Parameters:
$category – (array)(required) post category
$post_id – (int) post id
Example:
add_filter( 'wp_csv_exporter_category', 'wp_csv_exporter_category_filter', 10, 3 );
function wp_csv_exporter_post_category_filter( $category, $post_id ) {
$_category = array();
foreach ( $category as $key => $value ) {
$_category[] = 'Category:'.$value;
}
return $_category;
}
wp_csv_exporter_tax_{taxonomy}
Parameters:
$term_values – (array)(required) post taxonomy
$post_id – (int) post id
Example: taxonomy = “dogs”
add_filter( 'wp_csv_exporter_tax_dogs', 'wp_csv_exporter_tax_dogs_filter', 10, 3 );
function wp_csv_exporter_tax_dogs_filter( $term_values, $post_id ) {
$_term_values = array();
foreach ( $term_values as $key => $term_value ) {
$_term_values[] = 'Dog:'.$term_value;
}
return $_term_values;
}
wp_csv_exporter_{custom_field_key}
Parameters:
$field – (required) post custom field
$post_id – (int) post id
Example: custom field key = “price”
add_filter( 'wp_csv_exporter_price', 'wp_csv_exporter_price_filter', 10, 3 );
function wp_csv_exporter_price_filter( $field, $post_id ) {
return 'Price:'.$field;
}
