I have added a redirect for my plugin in init:

add_rewrite_rule( 'city/([a-zA-Z]+)/?$', 
'wp-content/plugins/csv-to-html/templates/csvtohtmlpage_core.php?city=$1' ); 

When I go to <site>/city/london the $_GET['city'] contains london. When I go to <site>/city/manchester the $_GET['manchester'] contains manchester and shows the the expect template (wp-content/plugins/csv-to-html/templates/csvtohtmlpage_core.php). etc..

This works as expected...

Is it possible to change redirect template (wp-content/plugins/csv-to-html/templates/csvtohtmlpage_core.php) through a shortcode? , eg.. [csvhtml_create template="template2"] which for example would use wp-content/plugins/csv-to-html/templates/templates2.php instead.

I've tested to put add_rewrite_rule() where the actual shortcode (when it triggers) without success so my guess the answer is no, but I want it confirmed :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.