/ Published in: PHP
courtesy of mark8barnes (http://wordpress.org/support/profile/52354)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
add_action('init', 'flush_the_rewrite_rules'); add_filter('generate_rewrite_rules', 'create_rewrite_rules'); add_filter('query_vars', 'add_query_vars'); function create_rewrite_rules() { $variable='download'; add_rewrite_rule($wordpress_root.'/'.$variable.'(/(.*))?/?$', 'index.php?pagename=$matches[1]&'.$variable.'=$matches[3]'); } function flush_the_rewrite_rules () { flush_rewrite_rules; } function add_query_vars($public_query_vars) { $public_query_vars[] = 'download'; return $public_query_vars; }
URL: http://wordpress.org/support/topic/194206