php - How to use the Wordpress API to install plugins
335
How can I install and activate a predefined list of WP plugins using the WP API using Php please?
How can I install and activate a predefined list of WP plugins using the WP API using Php please?
People are also looking for solutions to the problem: php - Hyphen missing in my Custom Post Type URL Slug
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
Find the answer in similar questions on our website.
Answer
Solution:
The REST API doesn't support plugin based actions yet. See the API handbook reference for information on what endpoints are currently available.
You can add custom endpoints though which would open this up for you, but due to the authentication methods available in the REST API at the moment (cookies), it does mean you have to be careful about who can access the endpoint.
A better approach to all of this is to use WP-CLI. It's an official WordPress project that lets you control the site from the command line. This is the best approach I think.