Support » Plugin: Relative URL » improvement to exclude urls

  • I love the plugin and it’s the first one I install in my staging sites but sometimes it interferes with development in my case. For example when I need to send post data containing my site’s URL it gets turned to a relative url thus breaking things.

    I have a suggestion maybe you’d like to add to the plugin.

    First of all the ideal way would be to create a setting to add masks / regular expressions for urls to skip from converting to relative. That way we can add cases where we want to ignore conversion. Since I understand that this would be a big overhaul of the code I think for now a filter would help a lot so we can customize it.

    For example in function wp_make_link_relative you could add an apply_filters function to help us hook to it and modify accordingly. What do you think about something like this but it would help more if we could pass the original full url as parameter?

    function wp_make_link_relative($link)
    {
    $relative_link = preg_replace(‘|^(https?:)?//[^/]+(/?.*)|i’, ‘$2’, $link);
    return apply_filters(‘make_relative’, $relative_link, $link);
    }

    • This topic was modified 8 months, 2 weeks ago by iowebgr.
  • The topic ‘improvement to exclude urls’ is closed to new replies.