Introduction
In Starter Templates we can also import the site with WP CLI command. To import the site we need the site ID. We can get site ID by listing all sites. In this doc, we will explain step by step process on how to import starter templates with WP CLI command. If you are not familiar with the WP CLI Command, we recommend you to check the documentation from here.
List Sites
Every site has a unique ID and to get that ID, we will need to list the sites. We can use below command to list the sites:
wp starter-templates list
Result:
$ wp starter-templates list
+-------+-------------------+-----------------------------------------+---------+----------------+--------------+
| id | title | url | type | categories | page-builder |
+-------+-------------------+-----------------------------------------+---------+----------------+--------------+
| 34184 | Nutritionist | //websitedemos.net/nutritionist-01 | free | Business, Free | Elementor |
| 34055 | Law Firm | //websitedemos.net/law-firm-03 | premium | Business | Elementor |
+-------+-------------------+-----------------------------------------+---------+----------------+--------------+
By default, we can see the sites of the current page builder. We can use below options to list specific sites by page builder, category, type, etc.
Functions
You can also add the following options while listing the websites.
- [–per-page=<number>] : No of sites to show in the list. By default it will be showing 10 sites.
- [–search=<text>] : Show the sites from a particular search term.
- [–category=<text>] : Show the site from the specific category.
- [–page-builder=<text>] : List the sites from the particular page builder.
- [–type=<text>] : List the sites from the particular site type.
Example:
$ wp starter-templates list --per-page=1 --type=premium
+-------+-------------------+-----------------------------------------+---------+----------------+--------------+
| id | title | url | type | categories | page-builder |
+-------+-------------------+-----------------------------------------+---------+----------------+--------------+
| 34055 | Law Firm | //websitedemos.net/law-firm-03 | premium | Business | Elementor |
+-------+-------------------+-----------------------------------------+---------+----------------+--------------+
Import Site
We can get the site ID from command `wp starter-templates list` and use that site ID to import the site using the following command
wp starter-templates import
Example:
$ wp starter-templates import 34184
You can also add the below options while importing the starter templates
- <ID> : Site id of the import site.
- –yes : Avoid the prompt message which asks to import the site with y/n options. If we enter y then site import starts. If we enter n then site import prevents. If we don’t want such a prompt message then use –yes which avoids that prompt message.
- [–reset] : If a site is recently imported then with this option the recently imported site data will be removed which includes post, pages, customizer settings, widgets etc.
Example:
$ wp starter-templates import 34184 --reset --yes
Activating Plugins..
Resetting Posts..