I'm writing a plugin, and need a function to run every time the permalink structure is changed. The function will calculate the new permalink for one of my pages.
The obvious thing seemed to be:
The problem is that when
get_permalink, it returns the old permalink, not the new one. Using
get_permalink doesn't work, either.
I can't use
add_action('generate_rewrite_rules', 'update_podcast_url') because this doesn't trigger if permalinks are turned off, only if the structure is changed.