Filter post_link to use an external URL
-
I’m trying to filter ‘post_link’, ‘page_link’, ‘post_type_link’. The Permalink Manager Plugin overrides these and prevents me from filtering them. This makes sense since the plugin is now managing the permalinks but I have a case where I want the permalink to link to an external source. I tried using “permalink_manager_filter_default_post_uri’ and then loading the custom ACF field value but the value is sanitized and the external URL breaks.
I have a URL field for external links. I would like that to be the permalink, automatically if the field has a value. I can obviously check to see if this field has a value, if so, print it, else use the default url. However, I’m trying to avoid that unnecessary code. Is there another hook that I could use? Wherever the post appears, I would like its permalink to be the external URL that was provided. Thanks for any assistance!
- The topic ‘Filter post_link to use an external URL’ is closed to new replies.