Support » Plugins » Hacks » Problem with wp_redirect

  • Resolved B.

    (@bandonrandon)


    Hello,
    I am making a plugin that redirects mobile phones to a new url. Everything is set up and working fine but I get a call to undefined function error when viewing the site on a mobile phone.
    Here is the code I’m using to redirect. I could probably use Header Redirect but it’s always better to use built in WordPress functionality

    if(get_option('mobileesp_wp_target_url') != ''){
    		if ($detect_mobile == 1) {
    		wp_redirect(get_option('mobileesp_wp_target_url'));
    		exit();
    		}
    	}


    UPDATE:
    If I wrap it in if (function_exists() i don’t get an error but I also don’t get a redirect.

    UPDATE 2:
    I fixed the problem by requiring pluggable.php as suggested by this article

  • The topic ‘Problem with wp_redirect’ is closed to new replies.