Support » Fixing WordPress » Redirect Issue

  • Resolved swayam.tejwani

    (@swayamtejwani)


    Hello Everyone,

    I am creating a simple plugin which use to redirect to url which you can define in edit page under custom field named ‘redirect’ , then when you view that page this will redirect to that url which you have defined in custom field, here is my code `
    function custom_redirect () {
    global $post;
    if ( is_page() || is_object( $post ) ) {
    if ( $redirect = get_post_meta($post->ID, ‘redirect’, true ) ) {

    wp_redirect( $redirect );
    exit;
    }
    }
    }
    add_action( ‘get_header’, ‘custom_redirect’ );`
    now when i add a url then when i see it takes me to the url something like this http://localhost/wordpress/www.google.com, i can’t figure it out why its not redirecting to google.com…does anyone help me out with this..

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect Issue’ is closed to new replies.