I would like to execute some php code when permalinks updated, I think some plugins I’m using them updates permalinks programmatically sometime and this breaks my some slug rewrite settings, at this point I need to run code when permalinks updated. Is there any filter or event listener to make me able to this.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
From what I know you can use the post_updated or the save_post hooks
https://developer.wordpress.org/reference/hooks/post_updated/ https://developer.wordpress.org/reference/hooks/save_post/
Hope that this help. If you need any other info please let me know.
Update:
Sorry for my misunderstanding. You can use the the_permalink filter. Below you have the docs
https://codex.wordpress.org/Plugin_API/Filter_Reference/the_permalink
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0