Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Automatically add WordPress site to your iControlWP control panel from ManageWP (or other)
<?php
/**
* You may automatically add any WordPress site to your iControlWP account by using the "code run"
* or "code snippets" feature in ManageWP.
*
* Please follow these steps:
*
* 1) Install and activate the iControlWP plugin on your WordPress site.
* 2) Grab your "AUTHENTICATION_KEY" from your iControlWP account:
* - https://app.icontrolwp.com/profile/preferences
* 3) Enter your AUTHENTICATION_KEY and registered iControlWP email address below where indicated.
* - ensure to keep the single quotes in-place.
* 4) Check the $path variable. This assumes your WP Content and plugins folders are "normal" and unchanged
* from defaults.
* 5) Copy and paste all the code into the "code snippets" tool. You don't need these comments, and
* please ensure the file starts with "<?php"
*/
$path = path_join( ABSPATH, 'wp-content/plugins/worpit-admin-dashboard-plugin/auto_add.php' );
$res = file_put_contents(
$path,
wp_json_encode( [
'api-key' => 'AUTHENTICATION_KEY',
'email' => 'REGISTERED_EMAIL_ADDRESS',
] )
);
if ( $res !== false && $res > 0 ) {
echo 'Auto-Add site configuration created. Site will be automatically added to your iControlWP account shortly.';
}
else {
echo 'Failed to create Auto-Add site configuration. You may not have file system permissions, or your directory structure is not as expected';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment