Viewed   86 times

I am using below code for redirection in wordpress

$currentPage = explode('?', $_SERVER ['REQUEST_URI']);
  $current_page_url = $currentPage[0];
 if($current_page_url == '/e-commerce')
    {
        header("Location : http://www.mysite.com/complete-e-commerce-solution",true);
    }

I am using this code in header.php, i am redirecting to third party site.is that problem?

 Answers

5

you need to follow the header call with an 'exit`. However, you might be better using wordpress's inbuilt wp_redirect function:

wp_redirect("Location : http://www.mysite.com/complete-e-commerce-solution");
exit;

Using wordpress functions allows plugins to filter the input and sanitises the input (not so applicable here, just good practice).

Friday, August 5, 2022
 
1

This should solve your problem. Adapted from an answer found here.

Add the following snippet of code in the functions.php file of your theme:

function admin_default_page() {
  return '/new-dashboard-url';
}

add_filter('login_redirect', 'admin_default_page');
Saturday, August 13, 2022
4

My hosted server settings were forcing mysite.com to www.mysite.com and this was causing the problem. I turned this setting off and everything works now, i'd still like to know how to make it work with this setting turned on, though!

Wednesday, September 28, 2022
4

I include 'pluggable.php' in my plugin and problem fixed

include_once(ABSPATH . 'wp-includes/pluggable.php');
Friday, September 16, 2022
 
pjv
 
pjv
3

Apparently in iOS 5.1 writing to stdout was disallowed. http://spouliot.wordpress.com/2012/03/13/ios-5-1-vs-stdout/

Thursday, November 3, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :