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

Description

This function retrieves a WordPress® cPAddon instance's configuration.

Notes:

  • You must install the WordPress Manager cPanel plugin to access this API function.
  • This function retrieves some 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_instance_by_id?id=cPanel__Blogs__WordPressX.0.1491917088

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.
 
// Retrieve a single WordPress instance by ID.
 $instances = $cpanel->uapi(
    'WordPressInstanceManager', 'get_instance_by_id',
	    array(
        'id'         =>   'cPanel__Blogs__WordPressX.0.1491917088',
        )
);

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.
 
# Retrieve a single WordPress instance by ID.
my $instances = $cpliveapi->uapi(
    'WordPressInstanceManager', 'get_instance_by_id',
	    {
        'id'         =>   'cPanel__Blogs__WordPressX.0.1491917088',
        }
);

Note:

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

 cPanel Template Toolkit
<!-- Retrieve a single WordPress instance by ID. -->
[% data = execute( 'WordPressInstanceManager', 'get_instance_by_id'{ 'id' => 'cPanel__Blogs__WordPressX.0.1491917088', } ); %]

Note:

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

 Command Line
uapi --user=username WordPressInstanceManager get_instance_by_id id=cPanel__Blogs__WordPressX.0.1491917088

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)
{
	"metadata": {},
	"errors": null,
	"messages": null,
	"status": 1,
	"data": {
		"available_version": "4.8",
		"autoupdate.core.minor": true,
		"homedir": "/home/example",
		"full_path": "/home/example/public_html",
		"admin_url": "example.com/wp-login.php",
		"current_version": "4.7.3",
		"id": "cPanel__Blogs__WordPressX.0.1491917088",
		"db_type": "mysql",
		"addon_type": "modern",
		"admins": [{
			"ID": 1,
			"user_login": "JGz9omL48u",
			"user_email": "example@example.com",
			"user_nicename": "jgz9oml48u",
			"display_name": "JGz9omL48u",
			"user_status": "0"
		}, {
			"ID": 2,
			"user_login": "test1",
			"user_status": "0",
			"user_nicename": "test1",
			"display_name": "test1",
			"user_email": "test1@example.com"
		}],
		"db_prefix": "wp",
		"db_server": "localhost",
		"site_url": "example.com",
		"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPressX.0.yaml",
		"rel_path": "",
		"initial_install_version": "4.7.3",
		"autoupdate": true,
		"autoupdate.core.has_filter": false,
		"autoupdate.core.major": false,
		"admin_username": "JGz9omL48u",
		"db_name": "example_wp1",
		"db_username": "example_wp1",
		"addon_name": "cPanel::Blogs::WordPressX",
		"domain": "example.com"
	}
}

Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
idstring

Required

The cPAddon instance's unique ID.

Note:

You can retrieve an instance ID with the get_instances function.

A valid instance ID.cPanel__Blogs__WordPressX.0.1491917088

 

Returns

ReturnTypeDescriptionPossible valuesExample

addon_config

stringThe WordPress cPAddon configuration file location.An absolute filepath.
 Click to view...

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

addon_name

stringThe WordPress cPAddon used to install the instance.
  • cPanel::Blogs::WordPress

  • cPanel::Blogs::WordPressX

cPanel::Blogs::WordPress

addon_type

stringThe type of WordPress cPAddon that installed the instance.
  • modern
  • legacy

modern

admin_url

stringThe URL to the instance's administration interface.A valid URL.

example.com/wordpress/wp-login.php

admin_username

stringThe administrator username configured at the time of installation.A valid string.admin
adminsarray of hashes

A list of the WordPress instance's administrators.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

This array of hashes contains the id, display_name, user_email, nice_name, and user_status returns. 

id

integer

The user's automatically generated identifier.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

A positive integer.1

display_name

string

The user's display name.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

A valid string.JGz9omL48u

nice_name

string

A simplified version of the user's username that is suitable to use as an HTML ID or similar.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

A valid string.JGz9omL48u

user_email

string

The user's email address.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

A valid email address.example@example.com

user_status

string

The user's verified status.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

  • 1 — Verified.
  • 0 — Unverified.
0

autoupdate

BooleanWhether the user enabled automatic updates.
  • true — Enabled.
  • false — Disabled.
false
autoupdate.core.has_filterBoolean

Whether one or more filters modify the core autoupdate settings.

Notes:

  • Typically, plugins apply filters to the autoupdate settings.
  • We introduced this return in WordPress Instance Manager version 1.1.
  • true — Filter(s) applied.
  • false — No filters applied.
false

autoupdate.core.major

BooleanWhether the user enabled automatic updates for major releases.
  • true — Enabled.
  • false — Disabled.
false

autoupdate.core.minor

Boolean
Whether the user enabled automatic updates for minor releases.
  • true — Enabled.
  • false — Disabled.
true

available_version

stringThe latest WordPress cPAddon's version.A WordPress version number.4.7.3

current_version

string

The WordPress cPAddon's installed version.

Note:

This function retrieves this return's value directly from the WordPress instance.

A WordPress version number.4.7.3

db_name

stringThe WordPress cPAddon's database name.A database name.example_wp

db_prefix

stringThe WordPress cPAddon's database prefix.A database table prefix.wp

db_server

stringThe WordPress cPAddon's database name.A valid hostname.localhost

db_type

stringThe WordPress cPAddon's database type.
  • mysql
  • postgres
mysql

db_username

stringThe WordPress cPAddon's database username.A database username.example_wp

domain

stringThe WordPress cPAddon's installation domain.A domain the cPanel account owns.example.com

full_path

stringThe WordPress cPAddon's full installation path.An absolute filepath.

/home/example/public_html/wordpress

 

homedir

stringThe cPanel account's home directory.An absolute filepath./home/example

id

stringThe WordPress cPAddon instance's unique identifier.A valid string.

cPanel__Blogs__WordPress.0.1486754861

initial_install_version

stringThe WordPress cPAddon's version at installation.A WordPress version number.4.7.2

rel_path

stringThe WordPress cPAddon's installation path, relative to the domain's document root.A valid filepath, relative to the domain's document root.wordpress

site_url

stringThe WordPress cPAddon's home page URL.A valid URL.

example.com/wordpress