Skip to content

Commit 166f23d

Browse files
Update amp_is_available() to check for cron & CLI (#5547)
Co-authored-by: Weston Ruter <[email protected]>
1 parent 213f4ef commit 166f23d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

includes/amp-helper-functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ function amp_add_frontend_actions() {
409409
function amp_is_available() {
410410
global $pagenow, $wp_query;
411411

412-
// Short-circuit for admin requests or requests to non-frontend pages.
413-
if ( is_admin() || in_array( $pagenow, [ 'wp-login.php', 'wp-signup.php', 'wp-activate.php', 'repair.php' ], true ) ) {
412+
// Short-circuit for cron, CLI, admin requests or requests to non-frontend pages.
413+
if ( wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) || is_admin() || in_array( $pagenow, [ 'wp-login.php', 'wp-signup.php', 'wp-activate.php', 'repair.php' ], true ) ) {
414414
return false;
415415
}
416416

0 commit comments

Comments
 (0)