Domanda

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

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top