Support » Plugin: Permalink Manager Lite » Filter post_link to use an external URL

  • Resolved rossberenson


    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Maciej Bis


    Hi @rossberenson,

    did you possibly try to register tour new hooks with the priority higher than “99”?


    add_filter( 'page_link', 'your_custom_filter', 100, 2);
    add_filter( 'post_link', 'your_custom_filter', 100, 2);
    add_filter( 'post_type_link', 'your_custom_filter', 100, 2);

    Best regards,

    Thread Starter rossberenson


    @mbis – Thanks for that suggestion. That worked. Sometimes you’re oblivious to the obvious.

    Plugin Author Maciej Bis


    No problem @rossberenson 🙂 I am glad that you managed to get it working.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.