Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load admin branch if wp_doing_cron() is true #3703

Open
jotazzu opened this issue Sep 8, 2023 · 0 comments
Open

Load admin branch if wp_doing_cron() is true #3703

jotazzu opened this issue Sep 8, 2023 · 0 comments

Comments

@jotazzu
Copy link

jotazzu commented Sep 8, 2023

I've created a custom plugin which archivates a post and creates a redirect when the events in the post are outdated. The plugin function is triggered by wp-cron.php requests. I'm using the PHP API of Redirection.

Currently I've added a hack to load the admin branch and disable the frontend branch of Redirection using action 'plugins_loaded' in case wp_doing_cron() is true.

In plugin Redirection the branches are loaded around line 87 in the initial file redirection.php:
if ( red_is_admin() || red_is_wpcli() ) {
     require_once DIR . '/redirection-admin.php';
     require_once DIR . '/api/api.php';
} else {
     require_once DIR . '/redirection-front.php';
}

Is it possible to add the check for wp_doing_cron() in this sequence, too? It would than look like:
if ( red_is_admin() || red_is_wpcli() || wp_doing_cron() ) {
     require_once DIR . '/redirection-admin.php';
     require_once DIR . '/api/api.php';
} else {
     require_once DIR . '/redirection-front.php';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant