WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Problem with wp_redirect (1 post)

  1. Brooke Dukes
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic