2

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.

2

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
1

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.