I would like to know what hook should I used when the permalink/url of a post is modified.
My goal is to get the old permalink and new permalink so I can used it for my plugin.
Thanks.
[EDIT]
Just want to clarify the question. I would like to get the old and new url in a scenario for example, when a user select one its post in the admin area, and edit the current permalink/url(/helloworld) into a new permalink/url(/helloworld_new) of the selected post.
I would like to get the complete url the post being edited.
You need to exactly use
wp_insert_post_data
. This contains array of post data what will be store into database after WordPress has done all of the validation/sanitization.Hope it helps.
The action is
update_option_permalink_structure
.The follow example works with this hook.
The hook in this context is always
update_option_{$option}
[orupdate_option_{$option_name}
(deprecated since WordPress 3.6)].Also related is
pre_update_option_{$option}
and a hook for the Multisite versionupdate_site_option_{$option}
andpre_update_site_option_{$option}
.