Pretty permalinks not registered/flushed
-
I have registered a custom post type with two related taxonomies. If pretty permalinks are turned off, everything works fine, but when they are enabled (the preferred option, using
/%category%/%postname%
) the rewrite rules for the custom post type and taxonomies registered through the Types plugin are not picked up by WP_Rewrite. This is specific to the CPTs registered through the Types plugin – other CPTs registered by other plugins work fine with pretty permalinks.I have already tried resetting the Permalinks settings (several times), deactivating and reactivating the plugin, disabling all other plugins, switching to a WordPress built-in theme, etc.
From further investigation, it seems that the post type registration (and requisite calls to add_permastruct) are occurring after the last call to generate/flush the rewrite rules. So WP_Rewrite continues to use the cached rewrite rules which do not include the rules added by Types. Hence they are never flushed to the DB either.
Short of forcing a flush in the ‘init’ action (yes, I know this is not recommended), any ideas on how to fix this?
- The topic ‘Pretty permalinks not registered/flushed’ is closed to new replies.