xml - Is it possible to export WordPress from command line?

admin2025-01-08  3

Is it possible to export WordPress from command line?

I don't mean use mysqldump to export the database, but create the xml file used to easily import to another WordPress installation.

Is it possible to export WordPress from command line?

I don't mean use mysqldump to export the database, but create the xml file used to easily import to another WordPress installation.

Share Improve this question asked May 21, 2014 at 19:20 PaulPaul 1741 silver badge9 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 8

Check out http://wp-cli.org/. It's fantastic and I've used the export capability multiple times.

More information on wp-cli.

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.

You will most likely have to install wp-cli. You can find instructions on wp-cli.org. There are also alternative installation instructions here: https://github.com/wp-cli/wp-cli/wiki/Alternative-Install-Methods

To export your posts using wp-cli, you can use the command.

wp export

There are many options to limit the export by date, post type, category, author, etc. Most details can be found on this page: http://wp-cli.org/commands/export/

I don't know of any other way to export an xml file from the command line.

export

wp export --dir=/var/www/site.com/htdocs/backup --user=admin --post_type=post --start_date=2021-05-07 --end_date=2021-05-08 --allow-root

import

wp import example.wordpress.2021-05-08.000.xml --authors=create --allow-root

If you are not root, discard --allow-root

Change example.wordpress.2021-05-08.000.xml to your filename

You need to change the information according to your usage. Directory name, filename, etc.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736267793a1223.html

最新回复(0)