Skip to content

Register command execution points using named WP-CLI hooks #15

Closed

Description

@danielbachhuber

WP-CLI runs most wp db * commands right after wp-config.php is located, but before the rest of WordPress is loaded: https://github.com/wp-cli/wp-cli/blob/d9d405a4ca01ba23e80277b8cb9000857e84e0cd/php/WP_CLI/Runner.php#L875

This is a special case system that should be switched to using named WP-CLI hooks.

From #1 (comment)

Activity

  1. added a commit that references this issue on Jun 1, 2017
  2. ScreamingDev commented on Aug 19, 2017

    @ScreamingDev

    Having a plugin for each project in our company, we want to extend some commands. db import is one of them. After this three other commands need to run. So it would be great if the import runs after plugins were loaded.

  3. danielbachhuber commented on Aug 20, 2017

    @danielbachhuber
    MemberAuthor

    So it would be great if the import runs after plugins were loaded.

    We probably won't be changing the behavior of wp db import, so I'd encourage you to find a different approach.

  4. diggy commented on Aug 25, 2017

    @diggy
    Contributor

    Just a small note on wp db subcommands using @WP_CLI::get_runner()->load_wordpress(); (note the error suppression with @): if there is a function definition present in wp-config.php these subcommands will fail, yielding no output at all. The error becomes clear when removing the @, e.g. Fatal error: Cannot redeclare functionname()

    https://wordpress.slack.com/archives/C02RP4T41/p1503590888000029

  5. added this to the 1.3.0 milestone on Nov 5, 2017
  6. added a commit that references this issue on Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    command:dbRelated to 'db' command

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions