wordpress - How to redirect based on URL -


I am using the Wp Store Locator plugin. And I have modified it according to its requirement. But I'm stuck in redirection.

Actually this plugin works with a small code. So the time to list my URL is like: localhost / wordpress /? Page_id = 391

Is there a link to me now that http: // localhost / wordpress /? Redirects to Wpsl_id = 3

: The code for:

add_action ("template_redirect", 'my_theme_redirect'); Function my_theme_redirect () {$ dpath = $ _SERVER ["HTTP_HOST"] $ _SERVER ["REQUEST_URI"]; $ Templatefilename = 'Single-Store Php '; If (strop ($ dpath, 'wpsl_id')! == incorrect) {$ return_template = get_template_directory () '/'. $ Templatefilename; // $ nurl = get_permalink ($ return_template); // resonant $ return_template; Go out; Wp_redirect ($ return_template); Go out; }}

This code is not redirecting to any place. This is the same page localhost / wordpress /? Page_id = 391 What can be the problem?

Anyone can suggest me how can I direct the URL when the wpsl_id is detected in the URL? I want to redirect them to the template folder of the plugin where I've added that file.

Edit :

I've added the above code to the plugin file above the short code Hope I have nothing to do with this issue :)

The template name looks OK You must register the template now before calling it

Add this filter so that it can be executed before your action:

add_filter ('template_include', 'single-store');


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -