admin管理员组

文章数量:1425972

How create post using WP-CLI at time of network site create. I am creating network sites using WP-CLI.
I have tried:

wp post create --post_type=page --post_title='ABC' --post_status=publish --network

But it creates post on main site. But, I want to create that post on network site which was created that time.

Thanks in advance.
Any reference will be helpful.

How create post using WP-CLI at time of network site create. I am creating network sites using WP-CLI.
I have tried:

wp post create --post_type=page --post_title='ABC' --post_status=publish --network

But it creates post on main site. But, I want to create that post on network site which was created that time.

Thanks in advance.
Any reference will be helpful.

Share Improve this question asked May 18, 2017 at 10:53 Rana GhoshRana Ghosh 1234 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 3

You can try the --url argument to target a given site in your network:

wp post create \
   --post_type=page \ 
   --post_title='ABC' \
   --post_status=publish \
   --url=http://example.tld/somesite/

where you can view available site urls with

wp site list

Global attribute --url=<url> is required to post in a networked site.

wp post create --url=subdomain.exampledomain [OPTIONS]

Ref : https://developer.wordpress/cli/commands/post/create/

本文标签: multisiteHow to create post in WP network using WPCLI