Best workaround to build a script in WordPress to change hyperlink structure on post save.
Scenario: an Author creates posts with hyperlinks <a href="http://www.example.com"></a> and saves, on save would be controlled if meets the hyperlinks given conditions to be redirected or not. If the urls has to be redirected than should change the structure of it <a href="goto.html?url=http://www.example.com"></a> and than push the post in database. What I want to avoid is to not force the Author to give attention on link creation.
You can simply add an action on
save_posthook, and parse content to modify links (using a dom parser, or regexp).But imo it is not a good idea to modify post content for this, you should modify links only when displaying post (with a
the_contentfilter).EDIT :
For example :