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?

316

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.

Posts           /wp/v2/posts
Post Revisions  /wp/v2/revisions
Categories      /wp/v2/categories
Tags            /wp/v2/tags
Pages           /wp/v2/pages
Comments        /wp/v2/comments
Taxonomies      /wp/v2/taxonomies
Media           /wp/v2/media
Users           /wp/v2/users
Post Types      /wp/v2/types
Post Statuses   /wp/v2/statuses
Settings        /wp/v2/settings

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.

People are also looking for solutions to the problem: php - Hyphen missing in my Custom Post Type URL Slug

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.