Visite Webhosting Latino, el site sobre alojamiento web.
Wordpress Theme Switcher plugin redirect modification - Mombu the Php Forum
Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > Wordpress Theme Switcher plugin redirect modification
User Name
REGISTER NOW! Mark Forums Read

sponsored links

1 25th March 21:05
External User
Posts: 1
Default Wordpress Theme Switcher plugin redirect modification


I would like to modify the Theme Switcher Plugin for Wordpress
( When I currently request
the page to switch the theme (for example: I'm redirected to the index.php, but
instead I would like to redirect back to the page where I was before
(for example:

Here is the code which is redirecting the page:

function ts_set_theme_cookie() { $expire = time
<>() + 30000000; if (!empty
<>($_GET["wptheme"])) { setcookie
<>("wptheme" . COOKIEHASH,
); $redirect = get_settings('home').'/'; if
(function_exists <>('wp_redirect'))
wp_redirect($redirect); else header
<>("Location: ". $redirect); exit
<>; } }

I've tried to change the $redirect variable to $_SERVER['REQUEST_URI']
but it doesn't worked. Then I realized that I should save the current
page URL in the cookies, so I've set a cookie and then I tried redirect
the page to the URL in that cookie. It worked, but not as intended,
there are some situations when it is redirecting in a loop.

Any recommendations how to do it properly?

  Reply With Quote

  sponsored links

2 26th March 00:44
External User
Posts: 1
Default Wordpress Theme Switcher plugin redirect modification

I don't know what added all those links, but it made this pretty

That said, the call to stripslashes is a dead giveaway that something
is very messed up in the code indeed...

This is awfully WordPress specific...

REQUEST_URI is the page you are on right now.

Re-directing there is pretty much an infinite loop.

Put it in $_SESSION maybe, but not a Cookie.

Rewrite WordPress from scratch? :-v

Ask the WordPress guys is probably the real answer.

Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
Yeah, I get a buck. So?
  Reply With Quote

Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -