Child pages
  • UAPI Functions - WordPressInstanceManager::get_instances
Skip to end of metadata
Go to start of metadata

Description

This function lists an account's 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. 

 Output (JSON)
{
	"data": {
		"instances": [{
			"created_on": "1528209264",
			"import_guid": "8AF1767E-68CD-11E8-90D1-96B06D626D05",
			"admin_url": "example.com/wordpress/wp-login.php",
			"domain": "example.com",
			"imported_on": "1528209264",
			"rel_path": "public_html/wordpress",
			"full_path": "/home/example/public_html/wordpress",
			"addon_type": "unmanaged",
			"db_prefix": "wp_",
			"available_version": null,
			"db_server": "localhost",
			"addon_name": "cPanel::Blogs::WordPressUnmanaged",
			"current_version": null,
			"db_name": "example_wp1",
			"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPressUnmanaged.0.yaml",
			"id": "cPanel__Blogs__WordPressUnmanaged.0.1528209264",
			"site_url": "example.com/wordpress",
			"homedir": "/home/example",
			"initial_install_version": null,
			"recent": 1,
			"db_username": "example_wp1",
			"admin_username": "admin2",
			"db_type": "mysql"
		}, {
			"rel_path": "",
			"admin_url": "example.com/wp-login.php",
			"created_on": "1528208546",
			"domain": "example.com",
			"db_prefix": "wp",
			"addon_type": "modern",
			"available_version": null,
			"db_server": "localhost",
			"full_path": "/home/example/public_html",
			"addon_name": "cPanel::Blogs::WordPressX",
			"db_name": "example_wp",
			"current_version": null,
			"admin_username": "admin",
			"db_type": "mysql",
			"site_url": "example.com",
			"homedir": "/home/example",
			"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPressX.0.yaml",
			"id": "cPanel__Blogs__WordPressX.0.1528208546",
			"recent": 1,
			"initial_install_version": "4.9.6",
			"db_username": "example_wp"
		}],
		"errors": []
	},
	"warnings": null,
	"status": 1,
	"errors": null,
	"messages": null,
	"metadata": {}
}


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 hash contains the addon_config, addon_name, addon_type, admin_url, admin_username, available_version, created_on, current_version, db_name, db_prefix, db_server, db_type, db_username, domain, full_path, homedir, id, import_guid, imported_on, initial_install_version, recent, rel_path, site_url, and whm_id returns.


addon_config

string

The WordPress instance's configuration file location.

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

An absolute filepath.
 Click to view...

/home/example/.cpaddons/cPanel::Blogs::WordPressX.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::WordPressUnmanaged


cPanel::Blogs::WordPressX

addon_type

string

The WordPress instance's installation method.

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

  • modern — Installed by RPM-managed WordPress cPAddon.
  • legacy — Installed by legacy cPAddon.
  • unmanaged — Installed by third-party tool or the WordPress installer.

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/wp-login.php

admin_username

string

The administrator username 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

This return is unused.

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


The function only returns this value as null.null

created_on

integer

The WordPress instance's installation date.

Note:

We introduced this return in WordPress Instance Manager version 2.0


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

A valid timestamp, in Unix Epoch time.1528208546

current_version

string

This return is unused.

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


The function only returns this value as null.

null

db_name

string

The WordPress instance's database name.

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

A database name.example_wp

db_prefix

string

The WordPress instance's database prefix.

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

A database table prefix.wp

db_server

string

The WordPress instance's database server hostname.

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

A valid hostname.localhost

db_type

string

The WordPress instance's database type.

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

mysql is the only possible value.

mysql

db_username

string

The WordPress instance's database username.

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

A database username.example_wp

domain

string

The WordPress instance's 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 instance's full installation path.

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

An absolute filepath.

/home/example/public_html

 

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 WordPress instance's unique identifier.

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

A valid string.
 Click to view...

cPanel__Blogs__WordPressX.0.1528208546

imported_guid

string

The imported WordPress instance's unique identifier.

Note:

We introduced this return in WordPress Instance Manager version 2.0

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

A valid string.
 Click to view...

8AF1767E-68CD-11E8-90D1-96B06D626D05

imported_on

integer

The WordPress instance's import date.

Note:

We introduced this return in WordPress Instance Manager version 2.0

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

A valid timestamp, in Unix Epoch time.

1528209264

initial_install_version

string

The instance's version at installation.

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

A WordPress version number.4.9.6

migrated_on

integer

The timestamp when the system migrated the instance from legacy to modern WordPress cPAddon.

Note:

We introduced this return in WordPress Instance Manager version 2.0

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

A valid timestamp, in Unix Epoch time.1528209264

migrated_from

string

The cPAddon that the system migrated the instance from.

Note:

We introduced this return in WordPress Instance Manager version 2.0

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

cPanel::Blogs::WordPress

cPanel::Blogs::WordPress

recent

Boolean

Whether the system added the WordPress instance in the last 24 hours.

Note:

We introduced this return in WordPress Instance Manager version 2.0

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

  • 1 — Added recently.
  • 0 — Added previously.
1

rel_path

string

The WordPress instance's installation path.

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

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

Note:

This function returns an empty value if the relative path is the document root.


site_url

string

The WordPress instance's home page URL.

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

A valid URL.

example.com