Remotely access WP Admin menus / functionalities
I am building an app which manages WP sites remotely.
All that is managed via the WP RestAPI poses no problem, but for such things as upgrading Updating / Uninstalling plugins, and other similar actions, I would need to open a window in my app with the WP Admin logged in, and preferably, with the desired action / url loaded…
I guess I would be using PHP’scURL to build and load the given URL ?
Say, for example, that I would like to DELETE the ‘DUPLICATOR’ plugin,the obscated URL for this is:
Where most of the stuff after “http://WP-site-url/wp-admin/plugins.php?action=delete-selected&checked%5B0%5D=duplicator%2Fduplicator.php“, however important is easily reproductible…
What I would need to know is how to include both username & password,and also, I guess a ‘NONCE’ into the cURL request, to directly access the above URL WITHOUT being re-routed to the login page.
Obviously, I have the admin user / password, and I can get a nonce built, using the nonce in config.php, if needed ?
Would someone kindly show me the way to do this, including the cURL options to set (I read – can’t recall from where…– that a cookie also needed to be included in the cURL request / options, holding the Admin login / data ?).
Many thanks for your help.
JMB
PS: I have found a WP plugin that enables such things as Plugins’ & Themes’ REMOTE management (CRUD…): SHIFT8 ; the plugin script is way too sophisticated to unwind, and their example script is cryptic: written in PYTHON (!?), which for me is “double-dutch” ! 🙁
Leave an answer