rewrite rules always flushed
-
It seems you forgot to change a few parts regarding the custom post types as they always call
flush_rewrite_rules()which uses$hard = trueas default value and always overwrites the .htaccess file.See also https://developer.wordpress.org/reference/functions/flush_rewrite_rules/
I have applied the following changes to resolve this:
https://gist.github.com/DanielRuf/c894deae0b904750b860f8bdb38c452e/revisions#diff-dc12a7c005d7301b56f3e7b2a1bcbb41d951f2b66a4c46a59abdfe167fba92a7You might want to refactor this part and check if at least one custom post type is created and only then flush the .htaccess file but only once.
The topic ‘rewrite rules always flushed’ is closed to new replies.