Is there a filter I can use to adjust link URLs before they are rendered?

Link Whisper

Last Update setahun yang lalu

Starting with Link Whisper 2.3.5, in-content link URLs can be modified to suit your site’s needs by using pre-display filters.


Doing this requires the use of two filters. The first is ‘wpil_add_link_attr_allow_change_url’, and it’s job is to tell Link Whisper that you want to modify link URLs.


The second filter is ‘wpil_add_link_attr_change_url’, and it’s job is to do the actual modifying.


As an example, here is a code snippet that makes sure all internal links have a trailing slash:

To install code such as this, you will need to insert it in your child theme’s functions.php file. If that’s not possible, or you’re not using a child theme, then the next best way to do it is with a PHP Code Snippets plugin.

Was this article helpful?

0 out of 1 liked this article

Still need help? Message Us