Feb 27, 2017 9:08 pm
Hi guys!
I have a problem. I use Pods for create a custom post type (CPT) and after activating in Pods rewrite setting for my CPT I found that it not works. I found in file wpf-hooks.php call of function flush_rewrite_rules(). I guess that it flush Pods rewrite rules and my CPT not works. Is it possible to disable this function wpforo_do_rewrite()?
4 Replies
Feb 27, 2017 9:40 pm
- Flushing the rewrite rules is an expensive operation, there are tutorials and examples that suggest executing it on the 'init' hook. This is bad practice. It should be executed either on the 'shutdown' hook, or on plugin/theme (de)activation.
- Flush rules only on activation or deactivation, or when you know that the rewrite rules need to be changed. Don't do it on any hook that will triggered on a routine basis. More detail information in the comments on WP Engineer's post: Custom Post Type and Permalink
add_action('init', 'wpforo_do_rewrite');
Is it really needed at any init?
https://codex.wordpress.org/Function_Reference/flush_rewrite_rules
Feb 28, 2017 8:08 am
Ok, thank you for letting us know, we'll take a look on this issue.
Mar 24, 2017 2:45 pm
Dear Robert,
is there any information about resolve this problem?
Mar 24, 2017 6:50 pm
We'll try to add this change in next release. It's cumming very soon.