WordPress: SSH and WP CLI

WordPress: SSH and WP CLI

I have seen the terms SSH and WP CLI for many years but never dipped my toe in that water. I am totally familiar with the concept of a command line as I have read the MS-DOS Reference Manual long ago. I have an issue with my website where there is no endpoint. Whatever an endpoint is. So I went down the path of figuring out what an endpoint is and how to fix my issue.

I learned that an endpoint has to do with an API, application programming interface. I was happy to find The Complete Guide to WordPress REST API Basics by Kinsta.

Setting up SSH

Before I could use the guide, I needed to be able to use SSH to run some commands and first I needed to learn how to use and even setup SSH. A quick search came up with: The Developer’s Guide to Start Using SSH (Connect to Your Server Securely). I discovered that I would have to set it up at my hosting provider, Namecheap.

At first I was going to use the Mac Terminal but found that there is a Terminal in my control panel. I would prefer to use this since I haven’t successfully logged in with the Mac Terminal. Either way I had to Enable SSH (Shell) in cPanel. One day I might return to the Mac Terminal again and learn How to connect via SSH using keys.

I knew a few console commands but wanted to run one basic command, echo, to see if it worked and it did!

From there I finally looked up WP CLI commands to see what they are. The first two that I used were wp config list and wp config path they worked!

cPanel Terminal

Getting Back to the API

Using the The Complete Guide to WordPress REST API Basics I am going through the basic steps of seeing if I can access the data.

I could see the data mentioned in the Kinsta article by navigating to this location in the browser https://www.mysite.com/wp-json/wp/v2. (I used my domain in place of mysite.com for all of these commands.)

With this success, I am returning to the original problems.

This command works on the command line.

curl -X GET https://www.mysite.com/wp-json/wp/v2/posts (Works!)

This command did not work on the command line.

curl -X GET --user username:password -i http://yoursite.com/wp-json/wp/v2/posts?status=draft
(Does not work yet.)

I need to take a break to read more and will continue tomorrow.

Problems

Here are the two problems that I am trying to investigate.

Problem 1 – Trying to Use Telegraph to Post a Webmention

WordPress: SSH and WP CLI

Invalid Auth Server ResponseThe authorization server (https://www.tmichellemoore.com/wp-json/indieauth/1.0/auth) did not return a valid response:

HTTP 400

{"response":{"error":"invalid_grant","error_description":"Invalid authorization code"},"raw_response":"{\"error\":\"invalid_grant\",\"error_description\":\"Invalid authorization code\"}","response_code":400}

Problem 2 – Brid.gy IndieBlocks Endpoint Warning

Warning: your blog's current webmention endpoint is https://www.tmichellemoore.com/wp-json/indieblocks/v1/webmention. If you want Bridgy to handle your blog's webmentions, change it to https://brid.gy/webmention/wordpress.

I have temporarily deleted the IndieBlocks plugin so I am not sure why that is still there.

Read more: WordPress: SSH and WP CLI

Posted

in

by

Tags:

Comments

3 responses to “WordPress: SSH and WP CLI”

Mentions

  • WordPress: Importing Tweets with Twitter Archive to WP Plugin | T Michelle Moore

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: