Skip to content

ALTERNATE_WP_CRON can trigger a redirect on the CLI #3104

@johnbillion

Description

@johnbillion

If the ALTERNATE_WP_CRON constant is defined on a site, any CLI command can potentially fail due to the cron spawner attempting a redirect (which gets caught by WP_CLI\Utils\wp_redirect_handler()).

WP-CLI can avoid this with the following:

if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
    remove_action( 'init', 'wp_cron' );
}

Not sure where best to place this, and also I'm wondering whether WordPress core should add some extra logic to this condition so it doesn't attempt a redirect on the CLI.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions