How to Create WordPress Page that redirects to another URL (for google goal taking)

01-06-2017 14:51

With Wordpress templates, I'm assuming that headers are sent to the browser by WP before your template is even loaded. Because of that, the common redirection method of:

header("Location: new_url");

won't work. Unless there's a way to force sending headers through a template before WP does anything, you'll need to use some Javascript like so:

<script language="javascript" type="text/javascript">
document.location = "new_url";

Put that in the section and it'll be run when the page loads. This method won't be instant, and it also won't work for people with Javascript disabled.

Now... setup Google traking goal.

Tags: redirects to another URL, WordPress
Average rating: 5 (1 Vote)

You cannot comment on this entry