flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
Have you tried delete_option(‘rewrite_rules’); on deactivate? I came across the following when investigating this problem and it did the trick for me: Typically you register post types on init. Some time after that, you get the deactivation action. A responsible plugin would remove its rewrite rules by flushing. However, it can’t undo the registration, so … Read more