Page tree
Skip to end of metadata
Go to start of metadata

Description

This function lists an account's cPAddon-deployed WordPress® instances.

Notes:

  • You must install the WordPress Manager cPanel plugin to access this API function.
  • This function retrieves data that the system stored during the WordPress installation. That data may not reflect the most recent user changes.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/WordPressInstanceManager/get_instances

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List the account's WordPress instances.
 $instances = $cpanel->uapi(
    'WordPressInstanceManager', 'get_instances',
);

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List the account's WordPress instances.
my $instances = $cpliveapi->uapi(
    'WordPressInstanceManager', 'get_instances',
);

Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- List the account's WordPress instances. -->
[% data = execute( 'WordPressInstanceManager', 'get_instances' ); %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username WordPressInstanceManager get_instances

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
	"errors": null,
	"messages": null,
	"status": 1,
	"metadata": {},
	"data": {
		"instances": [{
			"db_username": "example_wp",
			"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPress.0.yaml",
			"initial_install_version": "4.7.2",
			"db_type": "mysql",
			"db_prefix": "wp",
			"full_path": "/home/example/public_html/wordpress",
			"rel_path": "wordpress",
			"current_version": null,
			"admin_url": "example.com/wordpress/wp-login.php",
			"site_url": "example.com/wordpress",
			"homedir": "/home/example",
			"addon_type": "legacy",
			"db_server": "localhost",
			"available_version": "4.7.3",
			"db_name": null,
			"addon_name": "cPanel::Blogs::WordPress",
			"domain": "example.com",
			"id": "cPanel__Blogs__WordPress.0.1486754861",
			"admin_username": "admin"
		}, {
			"db_username": "example_wp1",
			"db_type": "mysql",
			"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPressX.0.yaml",
			"initial_install_version": "4.7.3",
			"rel_path": "",
			"db_prefix": "wp",
			"full_path": "/home/example/public_html",
			"current_version": null,
			"admin_url": "example.com/wp-login.php",
			"site_url": "example.com",
			"homedir": "/home/example",
			"db_name": "example_wp1",
			"available_version": "4.7.5",
			"addon_name": "cPanel::Blogs::WordPressX",
			"domain": "example.com",
			"addon_type": "modern",
			"db_server": "localhost",
			"id": "cPanel__Blogs__WordPressX.0.1491917088",
			"admin_username": "JGz9omL48u"
		}, {
			"db_username": "example_wp2",
			"db_type": "mysql",
			"initial_install_version": "4.7.3",
			"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPressX.1.yaml",
			"rel_path": "",
			"full_path": "/home/example/blog.example.com",
			"db_prefix": "wp",
			"admin_url": "blog.example.com/wp-login.php",
			"current_version": null,
			"homedir": "/home/example",
			"site_url": "blog.example.com",
			"domain": "blog.example.com",
			"available_version": "4.7.5",
			"db_name": "example_wp2",
			"addon_name": "cPanel::Blogs::WordPressX",
			"db_server": "localhost",
			"addon_type": "modern",
			"admin_username": "vJyn5etbLs",
			"id": "cPanel__Blogs__WordPressX.1.1491917133"
		}],
		"errors": []
	}
}

Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
errorsarrayThis array contains the errors that the system experienced while it retrieved the instances.  
instancesarray of hashesAn array that contains the WordPress instance information.Each hashes contains the addon_config, addon_name, addon_type, admin_url, admin_username, available_version, current_version, db_name, db_prefix, db_server, db_type, db_username, domain, full_path, homedir, id, initial_install_version, rel_path, and site_url returns.


addon_config

string

The WordPress cPAddon configuration file's location.

The function returns this value in the instances array of hashes.

An absolute filepath.
 Click to view...

/home/example/.cpaddons/cPanel::Blogs::WordPress.0.yaml


addon_name

string

The WordPress cPAddon that installed the instance.

The function returns this value in the instances array of hashes.

  • cPanel::Blogs::WordPress

  • cPanel::Blogs::WordPressX

cPanel::Blogs::WordPress

addon_type

string

The type of WordPress cPAddon that installed the instance.

The function returns this value in the instances array of hashes.

  • modern
  • legacy

modern

admin_url

string

The URL to the instance's administration interface.

The function returns this value in the instances array of hashes.

A valid URL.

example.com/wordpress/wp-login.php

admin_username

string

The administrator username the the installer created at the time of installation.

The function returns this value in the instances array of hashes.

A valid string.admin

available_version

string

The latest Wordpress cPaddon's version.

The function returns this value in the instances array of hashes.

Note:

We removed this return in WordPress Instance Manager version 1.1.


A WordPress version number.4.7.3

current_version

string

The WordPress cPAddon's installed version.

The function returns this value in the instances array of hashes.

Note:

We removed this return in WordPress Instance Manager version 1.1.


null

null

db_name

string

The WordPress cPAddon's database name.

This function returns this value in the instances array of hashes.

A database name.example_wp

db_prefix

string

The WordPress cPAddon's database prefix.

The function returns this value in the instances array of hashes.

A database table prefix.wp

db_server

string

The WordPress cPAddon's database name.

The function returns this value in the instances array of hashes.

A valid hostname.localhost

db_type

string

The WordPress cPAddon's database type.

The function returns this value in the instances array of hashes.

  • mysql
  • postgres
mysql

db_username

string

The WordPress cPAddon's database username.

The function returns this value in the instances array of hashes.

A database username.example_wp

domain

string

The WordPress cPAddon's installation domain.

The function returns this value in the instances array of hashes.

A domain that the cPanel account owns.example.com

full_path

string

The WordPress cPAddon's full installation path.

The function returns this value in the instances array of hashes.

An absolute filepath.

/home/example/public_html/wordpress

 

homedir

string

The cPanel account's home directory.

The function returns this value in the instances array of hashes.

An absolute filepath./home/example

id

string

The cPAddon instance's unique identifier.

The function returns this value in the instances array of hashes.

A valid string.

cPanel__Blogs__WordPress.0.1486754861

initial_install_version

string

The cPAddon's version at installation.

The function returns this value in the instances array of hashes.

A WordPress version number.4.7.2

rel_path

string

The WordPress cPAddon's domain installation path.

The function returns this value in the instances array of hashes.

A valid filepath, relative to the domain's document root.wordpress

site_url

string

The WordPress cPAddon's home page URL.

The function returns this value in the instances array of hashes.

A valid URL.

example.com/wordpress