Title: Upgrade database programmatically on installation
Last modified: July 27, 2021

---

# Upgrade database programmatically on installation

 *  Resolved [luigitec](https://wordpress.org/support/users/luigitec/)
 * (@luigitec)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/upgrade-database-programmatically-on-installation/)
 * Hello guys,
 * I wish you could direct me on the right direction:
 * – Working a WordPress MU Installation
    – I create the sites via a custom REST
   API endpoint which runs several things – When I create a new site, I get the 
   warning message “Please complete your Redirection setup to activate the plugin”
 * I’m trying to run such setup via the REST API endpoint as a callback with the
   following methods:
 *     ```
       WP_CLI::runcommand('redirection database install'); //and the url as a parameter
       WP_CLI::runcommand('redirection database upgrade'); //and the url as a parameter
       WP_CLI::runcommand('redirection setting monitor_post 1'); //and the url as a parameter
       ```
   
 * But for some reason, it’s not working, I tried the same WP-CLI commands to make
   sure they work, and noticed that it ignores the `--url=` parameter and updates
   all the sites on the MU network:
 * `wp redirection database install --url=http://testdomain.dev`
 * The above returns:
 *     ```
       Success: Site 1 database is installed
       Success: Site 64 database is installed
       Success: Site 65 database is installed
       Success: Site 66 database is installed
       Success: Site 67 database is installed
       Success: ...
       ```
   
 * As you can see, it ran across all the blogs on the installation, not just the
   one on the `--url` parameter.
 * Also, I’m trying to enable the Monitor for post slug chances, I ran:
    `wp redirection
   setting monitor_post 1 --url=http://testdomain.dev` or `wp redirection setting
   monitor_post true --url=http://testdomain.dev`
 * But none of the above worked, just without the `--url` parameter it returned 
   the expected `Success: 1`
    -  This topic was modified 4 years, 10 months ago by [luigitec](https://wordpress.org/support/users/luigitec/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/upgrade-database-programmatically-on-installation/#post-14837901)
 * I’ve tracked it here:
 * [https://github.com/johngodley/redirection/issues/3045](https://github.com/johngodley/redirection/issues/3045)

Viewing 1 replies (of 1 total)

The topic ‘Upgrade database programmatically on installation’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [John Godley](https://wordpress.org/support/users/johnny5/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/upgrade-database-programmatically-on-installation/#post-14837901)
 * Status: resolved