brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: curl the wp-json root and jq namespaces to see which wordpress REST routes exist

WordPress
~/tips/tip-wordpress-rest-root-namespaces-jq

curl -s https://example.com/wp-json/ | jq '.namespaces'

Fetches the REST API index and lists the route namespaces, including those added by plugins.

A plugin that registers REST routes is easy to check from the terminal.

curl -s https://example.com/wp-json/ | jq '.namespaces'
curl -s 'https://example.com/?rest_route=/' | jq '.name'

The root of the REST API describes itself. namespaces lists every group of routes, such as wp/v2 for core and a vendor name for a plugin, and routes has all the paths. The second line uses the rest_route query argument, which works when pretty permalinks are not active or when /wp-json/ gets a 404. A security plugin or the web server can block the API for anonymous visitors, so a 401 or 403 here points at that and not at WordPress.

Further reading: WordPress REST API Handbook

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link