Question

I have created a plugin that uses custom posts. To get these to display the permalinks need re-saving, no need to change anything, they just need re-saving.

There must be a way to do this using a hook but I can't work out how to do this. The function flush_rules looks like it might do the job but it doesn't seem to work.

Sample code here: http://codex.wordpress.org/Rewrite_API/flush_rules

Was it helpful?

Solution

Ok solved it.

You just have to add the flush to the custom post registration:

register_post_type('custompostname',$args); flush_rewrite_rules(false);

So simple really, just took me a while to find it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top