• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Get WP get_home_path() via CLI

gbotica

Regular Pleskian
Hi,

In Plesk 12.5, I could use:

Code:
plesk bin wp_instance --get-list

to get a list of all the "attached" WordPress sites in Plesk. However, the only useful thing returns in the Installation URL.

I thought I read that this was later enhanced to return the webroot of each WP instance as well. But now wp_instance appears to be gone in Onyx?

So, I ended up using:

Code:
SELECT dom.id, dom.name, h.www_root FROM domains dom LEFT JOIN DomainServices d ON (dom.id = d.dom_id AND d.type = 'web') LEFT JOIN hosting h ON h.dom_id = dom.id

To get a list of: site.domain | webroot path

However, it would be great to be able to get: site.domain | get_home_path() using the WP CLI?

Is there a way to do this with Plesk Onyx?

Thanks for your time.
 
Hello,

In Plesk Onyx you have an ability to retrieve short or full information about WordPress instances using --list or --info CLI commands correspondingly. For example:

plesk ext wp-toolkit --list
plesk ext wp-toolkit --info -instance-id 123
plesk ext wp-toolkit --info -domain-id 12 -path /httpdocs

Output of --list command conatins following data:
  • WordPress instance identity
  • Main domain (subscription) identity
  • Path to WordPress files, related to main domain root directory
  • Instance owner identity
  • Flag, is instance works properly (is alive)
  • WordPress site URL
  • Name of WordPress instance
  • Version of WordPress
  • Count of installed plug-ins (optional)
  • Count of installed themes (optional)
Output of --info command contains all available WordPress instance data, including configuration paramentes, plug-ins and themes details, etc.

Also, you can retrive data in JSON by using key '-format json'. See 'plesk ext wp-toolkit --help' for details.

This feature available since vesion 2.0.4 of WordPress Toolkit Plesk extension.
 
Thank you so much! I was not aware of how to access the WP Toolkit's CLI.

I have now found this documentation: WordPress Toolkit in Plesk

This is what i used to get all WP Toolkit instances site name and path:

Code:
plesk ext wp-toolkit --info -instance-id 1 -format json | jq --raw-output '.name, .full_path'

This will be useful when scripting, I can use:

Code:
plesk ext wp-toolkit --list -format json | jq '.[] .id'

To get a list of all Wp Toolkit instance iDs, then loop through the IDs, doing WP-CLI stuff, like this:

Code:
plesk ext wp-toolkit --wp-cli -instance-id 1 -- core verify-checksums
 
Back
Top