wordpress - How to redirect based on URL -



wordpress - How to redirect based on URL -

i using wp store locator plugin.and have modified according need.but stuck in redirection.

basically plugin works short code.so @ time of listing url : localhost/wordpress/?page_id=391

now there 1 link redirects me http://localhost/wordpress/?wpsl_id=3

here code :

add_action("template_redirect", 'my_theme_redirect'); function my_theme_redirect() { $dpath = $_server["http_host"] . $_server["request_uri"] ; $templatefilename = 'single-store.php'; if (strpos($dpath,'wpsl_id') !== false){ $return_template = get_template_directory() .'/' .$templatefilename ; //$nurl = get_permalink($return_template); //echo $return_template; exit; wp_redirect($return_template); exit; } }

this code not redirecting me any-where.it stays on same page localhost/wordpress/?page_id=391 might issue?

anyone can suggest me how can direct url when detects wpsl_id in url ? want redirect them plugin's template folder have added file that.

edited :

i have added above code in plugin file above short code. hope has nil issue :)

the template name looks fine. need register template before phone call it.

add filter execute before action:

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

wordpress redirect plugins

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -