WP-CLI for site owners and admins
Discussed in https://github.com/WordPress/developer-blog-content/discussions/243
Originally posted by zzap March 23, 2024 WP-CLI is still scary to many developers, which is somewhat understandable given that it doesn't play nicely with Windows machines. A lot of developer tools, initially CLIs, have their GUIs today, and people opt to use them (which increases the fear of terminal).
So let's skip the setup part altogether and take a look at WP-CLI possibilities out of the box, i.e., hosting servers. The WP-CLI handbook already has a list of hosting providers with preinstalled WP-CLI and plugins with their custom WP-CLI commands, so we're clear on "not recommending any company or product".
We could go in general here and explain how WP-CLI can be used on the hosting provider's server, provide use cases, etc. If there were fewer providers, it would be beneficial to have a little walkthrough of the dashboard and show where the terminal is and how to start it, but each of them certainly has a guide on their blog, so we could just say, "Find the blog post and follow instructions".
I'd focus here mainly on site owners and administrators and what they can do in specific situations, e.g., manage user access (when the site is hacked or similar), install plugins for debugging and running various scans, switch to the default theme and deactivate all plugins to find the error, move a large number of posts to a different category/tag as a recommendation from an SEO agency, etc.
Goal: empower experienced users to be more advanced; support hosting providers with WP-CLI; support plugin authors who include custom WP-CLI commands; promote the WP-CLI tool as the most powerful and quickest tool for managing a WordPress instance.
The title is debatable. I don't like it, but it describes what the article is about.
Current state: it's a mess; a pile of research, code samples and ideas. I'll share the draft here as soon as I get some structure at least.
@zzap Thanks for the update! Can't wait to read a draft (no pressure of course)
@zzap Just checking if there are any blockers, I can help remove to get this article over the finish line?
@bph As promised, here's the draft, ready for review: https://docs.google.com/document/d/15UiITFOZbdT7XLo1eW6m2Ru9Gmc_YtR5oVGcg5CKjJc/edit?usp=sharing
Need to step away and will get back later in the afternoon. This is how far I got.
@bph I'm thinking that maybe one important detail is missing. Instruction on where to run these commands from - WordPress root, and how to know that you are in that directory (because different hosting providers have different file structures and you almost always have access at least one level above your root folder).
@zzap of course, you are right: it needs an additional section on "How to get to the server level of the website with the SSH access, to actually use WP-CLI or how to use them remotely. "
I am through with the first review and left a few more comments.
- It would be good to have more screenshot or even videos to make things a bit more palatable. You can upload the video right to the site, to add them to the post.
- Be consistent when using directoryies start with a slash and use inline code formatting. It's not so well done on Google Docs, so you would need to go over it when moving the content to the site.
@bph I added a bunch of screenshots and one video (which is GIF in draft but will be video in article) and Are you in your WordPress’ root? section.
"How to get to the server level of the website with the SSH access, to actually use WP-CLI or how to use them remotely. "
Remote use require opening terminal on local machine (a lot of people don't know they even have them), logging in via SSH, which might require them to have SSH Keys and connection with remote server.. that's far beyond what I want to do here. Hosting providers usually have tutorial with screenshots, on how to access their terminal, so I'm counting on that part to be covered by them and take the reader's hand once they are in terminal, logged in.
I'll get to this today (2nd review).
Great work, @zzap!!! I learned a lot reading through this. The second review is complete. It's mostly just minor grammatical suggestions.
Once you are ready to move the article to the Dev blog, here are the current checklists:
Pre-publishing checklist:
- [x] Post Title and subheaders in sentence case
- [x] Are Category or Categories selected?
- [x] Are Tags identifies?
- [x] Is there an explicit Excerpt?
- [x] Are all images files uploaded to the media library
- [x] Do all images have an alt-text?
- [x] For TOC us the Pattern under Developer Blog > Table of contents
- [x] Assign or upload a featured image
- [x] Props added? (See Guidelines)
- [x] add copy for a social post as comment to this issue (example) 🙌 Publish! 📗
Post-publishing checklist
- [x] add Props for reviews to #props channel in WP Slack (Example) (use Slack handles)
- [x] Add the label "post to social" to the issue
- [x] close the issue with a comment to link to the published post
- [x] close the accompanying discussion with the link to the published post.
Social copy:
As site owners and administrators, you can, and should use WP-CLI to efficiently secure and maintain your WordPress site by managing updates, monitoring changes, and creating backups. This article will teach you how. https://developer.wordpress.org/news/2024/09/09/website-security-checks-wp-cli-for-site-owners-and-administrators/
Post is published https://developer.wordpress.org/news/2024/09/09/website-security-checks-wp-cli-for-site-owners-and-administrators/
scheduled for Oct 1