There has been a misunderstanding of how page content works here:
but this code not modified links in page content. What is wrong with this code?
The filter you used will adjust the links atOnce the moment they're generated, but those links are saved in the pagepost content you have already been generated in the past. Modifying the code won't trigger WordPress to open up every page, regeneratereopen the contents,post and publishresave/reinsert for new updatescode to take effect. If it did there would be catastrophic consequences on large sitesFilters only modify the links when they are created, as well as lots of unintended problemsthey can't change already saved post content.
What About Widgets/Blocks/Shortcodes?
Those places where code is being used to generate the links at runtime dynamicallyPlaces such as shortcodes or server rendered blocks will immediatelyimmediatley update as there is no saved data that needs to be recreatedthey create new fresh HTML when viewed, but anything that stored those values in postthe database/post meta/post content will need to be manually updated.
Is There a Different Filter For This?
No, that's not how this works, you would still need to open those pages in the admin to change the links.
So What Should I Do?
You have several options:
- Find all the places that have your old custom HTML via search, edit and reinsert the links then save
- when you reinsert the links consider using a block or shortcode instead so that you don't have to do this again in the future
- if you are using a page builder you should ask in their communities as they can use different methods that require unique answers specific to that page builder