Support » Plugin: WP Store Locator » Error activating with WP-CLI

  • When activating the plugin using WP-CLI, it fails with a fatal error:

    
    PHP Fatal error:  Uncaught Error: Call to undefined function wpsl_add_roles() in /wp-content/plugins/wp-store-locator/inc/install.php:61
    Stack trace:
    #0 /wp-content/plugins/wp-store-locator/inc/install.php(36): wpsl_install_data()
    #1 /wp-content/plugins/wp-store-locator/wp-store-locator.php(114): wpsl_install(NULL)
    #2 /wp-includes/class-wp-hook.php(298): WP_Store_locator->install(NULL)
    #3 /wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
    #4 /wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #5 /wp-admin/includes/plugin.php(591): do_action('activate_wp-sto...', NULL)
    #6 phar:///usr/local/bin/wp/php/commands/plugin.php(284): activate_plugin('wp-store-locato...', '', NULL)
    #7 phar:///usr/local/bin/wp/php/WP_CLI/CommandWithUpgrade.php(208): Plugin_Command->activate(Array)
    #8 phar:///usr/local/bin/wp/php/commands/plugin.php(682): WP_CLI\Comm in /wp-content/plugins/wp-store-locator/inc/install.php on line 61

    Everything works fine via web.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    I think I see why. I never used WP-CLI myself, so never checked it 🙁 But the roles.php is only included when is_admin is true, so there’s no check for WP-CLI.

    If you don’t mind, can you try you replace this.

    if ( is_admin() ) {

    with the code below on this line, and see if it then works fine?

    if ( is_admin() || defined( 'WP_CLI' ) && WP_CLI ) {

    Hi Tijmen,
    works fine with the fix provided!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error activating with WP-CLI’ is closed to new replies.