Hooks don’t seem to work properly
-
Hello,
We’re attempting to conditionally intercept a redirect if a set of conditions are met. We tried several of the plugin hooks, and none seem to work. We’re wondering if the plugin author can provide some guidance. Here is our hook:
function post_redirect_extended($url, $type='302') { error_log(print_r('original url = ' . $url,1)); // # allowedIPs is set from REST auth plugin and saved to wp-options table // # define $allowedIPs as global global $allowedIPs; // # clean up spaces and line breaks from wp-option allowedIPs $allowedIPs = preg_replace('/^\s+|\n|\r|\s+$/m', '', get_option('allowedIPs')); $allowedIPs = (!empty($allowedIPs) ? $allowedIPs : array()); // # the user ip address $user_ip = $_SERVER['REMOTE_ADDR']; if(strpos($url, 'as400') !== false || strpos($url, 'apps.') !== false){ // # if requesting IP is in the allowedIPs array, return true if (in_array($user_ip, $allowedIPs)) { $url = get_site_url(); } } error_log(print_r('return url = ' . $url,1)); return $url; } add_action('qppr_do_redirect', 'post_redirect_extended', 1, 2); add_action('qppr_redirect', 'post_redirect_extended', 1, 2);
We’ve tried to log the output in the plugin’s core file, at around line 2209 we added:
error_log(print_r('qppr_do_redirect = ' . $urlsite,1));
… yet the url and redirect-type we’re trying to pass simply does not pass through to the do_action() function. Can you please provide clarity, and perhaps a brief example of how to over-ride the redirect?
Thank you.
- The topic ‘Hooks don’t seem to work properly’ is closed to new replies.