Questions tagged [template-redirect]

The tag has no usage guidance.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
174 views

Redirect custom post type category to other custom post type category

Two similar custom post types have been created by my theme and a plugin I'm using. These basically customizing the categories post type. They are as follows: product-category listing-category I am ...
1
vote
1answer
251 views

wp_redirect on base wp-admin and login

UPDATE: I've done some more research on my problem and have narrowed down the problem further. The question below has been very rewritten from the original. I'm trying set up a plugin to redirect ALL ...
1
vote
0answers
759 views

How do I determine what is causing a redirect for a given page?

This is probably a face palm question. On Wordpress 4.4. the link http://example.com/blog ...redirects to: http://example.com/category/general ...ie. it's redirecting to archive.php and ...
1
vote
0answers
48 views

Why does my URL rewriting only work using two different methods?

For our website, I've built out some "pages" using URL rewriting, with some code that I found here. It worked to have two of these special pages, but it's not working when I try to add a third. I've ...
1
vote
1answer
590 views

How to pass a message using template_redirect

I'm using the following function to redirect a post to another using custom field. It's working just fine until I added the line#8 to pass an ID so that I can grab it in to the post (to where was ...
0
votes
1answer
17 views

How to customize file path for 404 redirection in php?

I made a plugin with a custom post type postcard. Most of postcards are private. I would like to redirect the logged out user in a specific php file inside my plugin instead of the 404.php or achive....
0
votes
2answers
28 views

Redirect user to a custom url after logged in

I'm using "Passwordless Login with OTP / SMS & Email - Facebook Account Kit" for login. I want to redirect user to http://www.domain.com/author/<username>/screen after they log in this is ...
0
votes
0answers
10 views

Code custom redirect url after woocommerce registration

I'm trying the code for redirect url after registration, but its not working. I tried other options, I used the plugin, but it's same not work. I use registration form in "my_account" page. Could ...
0
votes
1answer
41 views

How to redirect (301) trashed post to it's parent taxonomy TERM ARCHIVE instead of 404 page

I have a taxonomy called "Sports", that includes terms: Football, Rugby, Tennis... What I want to achieve is when (for instance) a post that has the term football is trashed and a visitor try access ...
0
votes
0answers
20 views

How to stop WordPress template_redirect from interfering with custom redirects?

WordPress has a 'template_redirect' feature that will 301 redirect visitors who request a page that does not exist, if it can find a page that closely matches the one originally requested. For ...
0
votes
1answer
11 views

Internal redirect from page to category

I want to implement a page, let's say /today-deals that will show all posts under today category, like if we were navigating to /category/deals-for-october-31-2018 but without changing the URL.
0
votes
1answer
235 views

Redirect to first child in menu

I have the following page hierarchy: Page Grandparent (This page) Page Parent 1 (Should direct here) Page Parent 2 Page Child Page Child Page Parent 3 Page Parent 4 My parent and child pages have ...
0
votes
0answers
33 views

add_rewrite_rule returns 404 in parameter validation

Suppose I want to create a new rewrite rule like the following: add_action('init', 'fffl_router_add_rewrite_rules'); function fffl_router_add_rewrite_rules() { add_rewrite_rule('books/([^/]+)/?$',...
0
votes
3answers
676 views

How to redirect home page to another page after login for all user?

How to change home page to another page after login for all user roles, not a specific one?
0
votes
1answer
54 views

wp-admin redirects to standard wordpress page

I installed a Wordpress theme (NRGhost). It installs a plugin to use shortcodes (NRGhost Plugins) and other features. The plugin creates a custom redirect on wp-admin and redirects it to a custom ...
0
votes
1answer
129 views

redirect_to not Including Hashtag from URL

When non-logged-in users attempt to go to a forum topic that requires a login, I'm trying to redirect them to that topic after they've logged in. But I can't seem to get the anchor/hashtag to remain ...
0
votes
0answers
391 views

Force CSV download with template_redirect

I'm struggling to get a dynamically-generated CSV to download with a template_redirect. It seems to work (if not this exact version, another similar version) when it does not go through Wordpress, e.g ...
0
votes
1answer
392 views

template_redirect() doesn't seem to be working

kind of a rookie question but here goes: I'm working on a Wordpress theme from scratch on my local machine, and I'm setting up a static page for the Blog. I have my archive.php file for all the posts ...
0
votes
0answers
118 views

How to identifty post from its URL in 404 page?

Why GUID is such unstable? Some of the post's GUID are pretty permalinked, but most of them are default. I's using Pippin's function to get the post_id from its GUID, but it's not working if my site ...
0
votes
0answers
360 views

template_redirect and title

I pass a template_redirect in wordpress as hook but I want to have a personnalized title for this page and I miss to do that. Has someone any idea ? add_action( 'template_redirect', 'virtual_pages' );...
0
votes
0answers
672 views

template_redirect called twice

I am working of a simple redirect plugin that match the given slug and redirect to the assigned url, which i supposed to working fine. But recently i am adding the functionality to update the stat ...
0
votes
0answers
437 views

Adding a query var to taxonomy term archive - gets redirected to the other taxonomy archive page

I want to pass another query var in the URL through a form while I'm on a taxonomy archive page. The URL would look like so http://www.mydomain.com/tax_1/term_55/?&tax_1=term_1&tax_2=term2&...
0
votes
1answer
299 views

Custom template redirect based on url vars

I am using a custom URL on my menu to show the most viewed posts by passing the variables to the url as http://website.com/?v_sortby=views&v_orderby=desc However I want to use a custom template ...
-1
votes
1answer
1k views

redirect not logged in users to specific page and redirect them back where they come from

The problem is not the first redirection (already solved in other case here), the problem is the second redirection back. No problem with the first redirection, when no logged in user come to page ID ...