• Resolved jbyington

    (@jbyington)


    When I curl my website’s wp-cron.php file it gets redirected by Redirection. Because some code runs before the redirect gets triggered, it sets the DOING_CRON constant to true (wp-cron.php line 42) which persists through the redirect and then runs into wp-cron.php line 33

    if ( ! empty( $_POST ) || defined( ‘DOING_AJAX’ ) || defined( ‘DOING_CRON’ ) ) {

    die();

    }

    where it dies since DOING_CRON is already defined.

    This only happens in my production environment where Redirection is configured to redirect to https and also to www subdomain where the cron job is configured to http protocol and the root domain.

    I have added a filter hook for redirection_url_target into my functions.php and it didn’t seem to even get triggered. I haven’t spent enough time confirming but my assumption is that the redirect happens before functions.php is loaded, in which case I would need to move the hook to a plugin.

    Any suggestions are appreciated, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Godley

    (@johnny5)

    I’m not really sure what you mean here. Are you sure Redirection is causing the redirect? Other things also do. Why do you have a cron job configured on a different URL to your site?

    Thread Starter jbyington

    (@jbyington)

    My host runs a script that curls wp-cron.php every minute but it is not working. Their support member shared the response headers had the header set by Redirection. When they disabled Redirection their script worked.

    Plugin Author John Godley

    (@johnny5)

    Do you have a redirect that could affect WP Cron? The plugin won’t redirect things by itself.

    Thread Starter jbyington

    (@jbyington)

    There is not a specific redirect setup, but the options to redirect http to https and redirect the root domain to www subdomain seem to be the culprit.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.