Here are some tips to writing plugins with URL rewrites so that you get prettier variables instead of URL strings that are harder to read. Plus there maybe an SEO value to having more professional looking URLs.
Watch out for any Plugins like Yoast that Re-write things
If you have Yoast installed make sure that you hook the wpseo_tittle action to get the title updates to work correctly! Here’s an example.
add_filter( 'wpseo_title', 'my_plugin_title_overwrite_function', 15 );
How to check which steps are failing to initiate
Troubleshooting if your variables are actually correctly turned on with the names that you though they were named.
global $wp_query; echo "query vars<br>"; var_dump($wp_query->query_vars); echo "<br>"; echo "rewrite vars<br>"; global $wp_rewrite; print_r($wp_rewrite->rules);
$wp_rewrite->rules : These are the page re-write rules to change your URLs from variable values to human readable URLs.
$wp_query->query_vars : These are the variables values that are being passed in order for your rewrite rules to be able to be actuated by the plugin.
Hit the reset button
Sometimes an activation and deactivation of your plugin will clear up things that didn’t set correctly.