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

Description

This function retrieves a WordPress® 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.1528208546


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.1528208546',
        )
);


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.1528208546',
        }
);


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.1528208546', } ); %]


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.1528208546


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. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
	"metadata": {},
	"warnings": null,
	"status": 1,
	"data": {
		"addon_config": "/home/example/.cpaddons/cPanel::Blogs::WordPressX.0.yaml",
		"db_type": "mysql",
		"created_on": "1525876559",
		"db_prefix": "wp",
		"db_server": "localhost",
		"autoupdate.core.has_filter": false,
		"db_username": "example_wp2",
		"current_version": "4.9.5",
		"domain": "example.com",
		"full_path": "/home/example/public_html",
		"rel_path": "",
		"admin_username": "admin",
		"addon_type": "modern",
		"site_url": "example.com",
		"available_version": "4.9.6",
		"autoupdate.core.major": false,
		"id": "cPanel__Blogs__WordPressX.0.1528208546",
		"admin_url": "example.com/wp-login.php",
		"autoupdate": true,
		"initial_install_version": "4.9.5",
		"autoupdate.core.minor": true,
		"db_name": "example_wp2",
		"recent": 0,
		"addon_name": "cPanel::Blogs::WordPressX",
		"admins": [{
			"display_name": "admin",
			"user_nicename": "admin",
			"user_login": "admin",
			"ID": 1,
			"user_status": "0",
			"user_email": "admin@example.com"
		}],
		"homedir": "/home/example"
	},
	"errors": null,
	"messages": null
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
idstring

Required

The WordPress instance's unique ID.

Note:

You can retrieve an instance ID with the get_instances function.

A valid instance ID.
cPanel__Blogs__WordPressX.0.1528208546

 

Returns

ReturnTypeDescriptionPossible valuesExample

addon_config

stringThe WordPress instance's configuration file location.An absolute filepath.
 Click to view...

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

addon_name

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

  • cPanel::Blogs::WordPressX

  • cPanel::Blogs::WordPressUnmanaged
cPanel::Blogs::WordPressX

addon_type

stringThe WordPress instance's installation method.
  • 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

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

example.com/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.

The function returns the value in the admins array of hashes.

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.

The function returns the value in the admins array of hashes.

A positive integer.1

display_name

string

The user's display name.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

The function returns the value in the admins array of hashes.

A valid string.admin

nice_name

string

The user's simplified username, which you can use as an HTML ID or similar.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

The function returns the value in the admins array of hashes.

A valid string.admin

user_email

string

The user's email address.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

The function returns the value in the admins array of hashes.

A valid email address.admin@example.com

user_status

string

The user's verified status.

Note:

We introduced this return in WordPress Instance Manager version 1.1.

The function returns the value in the admins array of hashes.

  • 1 — Verified.
  • 0 — Unverified.
0

autoupdate

BooleanWhether the user enabled automatic updates.
  • true — Enabled.
  • false — Disabled.
true
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

string

The latest WordPress instance's version.

Note:

We introduced this return in WordPress Instance Manager version 2.0

A WordPress version number.4.9.6

created_on

integer

The WordPress instance's installation date.

Note:

We introduced this return in WordPress Instance Manager version 2.0

A valid timestamp, in Unix Epoch time.1528208546

current_version

string

The WordPress instance's version.

Note:

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

A WordPress version number.4.9.5

db_name

stringThe WordPress instance's database name.A database name.example_wp2

db_prefix

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

db_server

stringThe WordPress instance's database server hostname.A valid hostname.localhost

db_type

stringThe WordPress instance's database type.

mysql

mysql

db_username

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

domain

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

full_path

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

/home/example/public_html

 

homedir

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

id

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

cPanel__Blogs__WordPressX.0.1528208546

initial_install_version

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

rel_path

stringThe WordPress instance's installation path.

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

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

example.com/wordpress