I need to script configuration for an existing Wordpress site. Does wp-admin provide any kind of API for programmatic access? (Installing a local wrapper for access would be fine.)

For example, to change the site title or enable/disable an installed plugin.

  • 3
    Sounds like you want WP-CLI. There's APIs for everything else in wp-admin but it depends what you want to do, and you'd need to be logged in normally first. – Jacob Peattie Oct 23 '17 at 15:09
  • @JacobPeattie looks great, do you want to turn that into an answer? – lofidevops Oct 23 '17 at 15:12
  • WP Admin uses all the same core APIs, you'd be better just setting options directly rather than trying to do programmatic access to WP Admin which is at the end of the day just a GUI – Tom J Nowell Oct 23 '17 at 15:18
  • @TomJNowell do you mean directly modifying values in configuration files? – lofidevops Oct 23 '17 at 15:23
  • @d3vid more directly would be changing the options in the database, WP CLI just provides a convenient way to do that – majick Oct 23 '17 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.