Posts

Showing posts with the label filename

How to set name of the wxr file when exporting blog data using wp-cli

By default (actually, you cannot change right now), when you export blog data usingWP-CLI, the wxr will be name as following: myblogname.wordpress.2015.xml 1. Clone the wp-cli project: $ git clone https://github.com/wp-cli/wp-cli.git 2. Install composer and install WP-CLI's dependencies: $ curl -sS https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer $ cd /path/to/wp-cli/src/ $ composer install 3. Modify the get_filename_template function in /path-to-wp-cli-src/php/commands/export.php. For example, I want to name the exporting file after the blog's path: blog-1-path.xml $ nano /path/to/wp-cli/src/php/commands/export.php ... private static function get_filename_template() { $export_file_name = get_bloginfo('url') . ".xml"; $export_file_name = str_replace("http://", "", $export_file_name); $export_file_name = str_replace("/", "", $export_file_name); if( i...