Skip to content

Instantly share code, notes, and snippets.

@michaelbragg
Created October 19, 2021 12:54
Show Gist options
  • Save michaelbragg/82729bf5fbe9c434d72f814bca24791d to your computer and use it in GitHub Desktop.
Save michaelbragg/82729bf5fbe9c434d72f814bca24791d to your computer and use it in GitHub Desktop.
[WordPress] Create pages and assign special status
#!/bin/bash
# `--portcelain` makes the comand return only the ID
# `$_` is a special bash command that uses the last comands output.
# Run two commands in sequential, as the second command uses the output of the first.
echo $(wp post create --post_type="page" --post_title="Home" --post_status="publish" --porcelain)
wp option update page_on_front $_
# Run two commands in sequential, as the second cpage_for_posts ommand uses the output of the first.
echo $(wp post create --post_type="page" --post_title="Blog" --post_status="publish" --porcelain)
wp option update page_for_posts $_
wp option update show_on_front "page"
@wpmark
Copy link

wpmark commented Oct 19, 2021

What does the comment on line 1 mean please?

@michaelbragg
Copy link
Author

michaelbragg commented Oct 19, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment