Search
Search
Search
Search
Information
Information
Light
Dark
Open actions menu
Basic upload method
Bypass upload method
Tips!
If you encounter an error (by firewall) while uploading using both methods,
try changing extension of the file before uploading it and rename it right after.
This uploader supports multiple file upload.
Submit
~
var
www
candid-stg.bitkit.dk
httpdocs
wp-content
plugins
File Content:
wp-manager.php
<?php /* Plugin Name: WP Site Manager Connector Description: Allows external dashboard to fetch plugin/core update status. Version: 1.0 */ add_action('rest_api_init', function () { register_rest_route('site-manager/v1', '/status', [ 'methods' => 'GET', 'callback' => 'site_manager_get_status', 'permission_callback' => '__return_true' ]); }); function site_manager_get_status(WP_REST_Request $request) { $key = sanitize_text_field($request->get_param('key')); $saved_key = get_option('site_manager_api_key'); if (!$saved_key) { $saved_key = wp_generate_password(32, false); update_option('site_manager_api_key', $saved_key); } if ($key !== $saved_key) { return new WP_Error('unauthorized', 'Invalid API key', ['status' => 403]); } // Force WordPress to check updates wp_update_plugins(); wp_update_themes(); wp_version_check(); $plugin_updates = get_site_transient('update_plugins'); $all_plugins = get_plugins(); $plugins_data = []; foreach ($all_plugins as $path => $plugin) { $update_available = isset($plugin_updates->response[$path]); $latest_version = $update_available ? $plugin_updates->response[$path]->new_version : $plugin['Version']; $plugins_data[] = [ 'name' => $plugin['Name'], 'version' => $plugin['Version'], 'latest' => $latest_version, 'update' => $update_available ]; } $core = get_site_transient('update_core'); $core_update_available = false; $latest_core_version = get_bloginfo('version'); if (!empty($core->updates[0]) && !isset($core->updates[0]->response)) { $core_update_available = false; } elseif (!empty($core->updates[0]) && $core->updates[0]->response === 'upgrade') { $core_update_available = true; $latest_core_version = $core->updates[0]->version; } elseif (!empty($core->updates[0]) && isset($core->updates[0]->version)) { // Even if no update is available, get the latest version for display $latest_core_version = $core->updates[0]->version; } return [ 'site_name' => get_bloginfo('name'), 'core' => [ 'version' => get_bloginfo('version'), 'latest_version' => $latest_core_version, 'update_available' => $core_update_available ], 'plugins' => $plugins_data ]; } add_action('admin_menu', function () { add_options_page('Site Manager Connector', 'Site Manager Connector', 'manage_options', 'site-manager-connector', function () { $key = get_option('site_manager_api_key'); if (!$key) { $key = wp_generate_password(32, false); update_option('site_manager_api_key', $key); } echo "<div class='wrap'><h2>Site Manager Connector</h2>"; echo "<p><strong>API Key:</strong> <code>{$key}</code></p>"; echo "<p>Endpoint: <code>" . site_url('/wp-json/site-manager/v1/status?key=' . $key) . "</code></p></div>"; }); });
Edit
Download
Unzip
Chmod
Delete