开发者 |
miyauchi
megumithemes |
---|---|
更新时间 | 2015年4月24日 20:17 |
PHP版本: | 4.0 及以上 |
WordPress版本: | 4.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
acsv_post_object_keys
hook like following.
add_filter( 'acsv_post_object_keys', function( $post_object_keys ){ $post_object_keys['title'] = 'post_title'; $post_object_keys['content'] = 'post_content'; return $post_object_keys; } );
Other columns will be saved to the custom field.
There is a sample of the CSV.
https://gist.github.com/miya0001/06f1a8e2bf1789c7ddee
Action Hooks
$ wp csv import tests/_data/wp/sample.csv +------+-----------------------+------+---------+------------+---------------------+ | ID | Title | Type | Status | Author | Date | +------+-----------------------+------+---------+------------+---------------------+ | 1720 | CSV Import Test | post | publish | admin | 2013-09-13 00:00:00 | | 1721 | define author test | post | publish | admin | 2014-12-27 18:44:46 | | 1722 | define author id test | post | publish | themedemos | 2014-12-27 18:44:46 | | 1 | Hello world! Updated! | post | publish | admin | 2014-12-27 18:44:46 | +------+-----------------------+------+---------+------------+---------------------+
History:
$ wp csv log +----------+-----------------------------+---------------------+---------+---------+ | ID | Title | Date | Success | Failure | +----------+-----------------------------+---------------------+---------+---------+ | e0a66344 | Imported from WP-CLI. | 2014-12-27 18:44:46 | 4 | 0 | | 43c47af6 | Imported from admin screen. | 2014-12-27 16:53:17 | 4 | 0 | | df0f140b | Imported from WP-CLI. | 2014-12-27 16:21:42 | 4 | 0 | +----------+-----------------------------+---------------------+---------+---------+
Details of the history:
$ wp csv log e0a66344 +------+-----------------------+------+---------+------------+---------------------+ | ID | Title | Type | Status | Author | Date | +------+-----------------------+------+---------+------------+---------------------+ | 1720 | CSV Import Test | post | publish | admin | 2013-09-13 00:00:00 | | 1721 | define author test | post | publish | admin | 2014-12-27 18:44:46 | | 1722 | define author id test | post | publish | themedemos | 2014-12-27 18:44:46 | | 1 | Hello world! Updated! | post | publish | admin | 2014-12-27 18:44:46 | +------+-----------------------+------+---------+------------+---------------------+
plugin-name.php
to the /wp-content/plugins/
directory<?php do_action('plugin_name_hook'); ?>
in your templates