WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] External Protocols in Blogroll/Links Manager? (5 posts)

  1. macbis
    Member
    Posted 7 years ago #

    External protocol links do not seem to work when added to the Blogroll. I'm attempting to link to a Ventrilo server using:

    ventrilo://example.server.com:1234/servername=Example

    But WP prepends this with "http://", resulting in a broken link. Is there a workaround for this?

    A friend of mine pointed me to wp-includes/kses.php but the functions do not seem to be related to links in the blogroll.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Yeah, I wish they'd get rid of that...

    If you look in admin-functions.php, in the edit_link() function, around about line 600, you'll find this line:
    $_POST['link_url'] = clean_url($_POST['link_url']);

    Comment that line out or remove it entirely. That should fix it to allow you to put whatever you please in there.

  3. macbis
    Member
    Posted 7 years ago #

    Bwah, apparently they changed some of the functions relating to all of this between 2.1.2 and 2.1.3, which caused me a bit of confusion when looking at different versions of source code.

    The clean_url function looks like it has some semi-important stuff in it, so I was hesitant to comment the whole line out, so I took a closer look and narrowed it down to the following change:

    wp-includes/formatting.php @ Line 1082

    FROM:
    $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
    TO:
    $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'ventrilo');

    Thanks for your reply; it definitely pointed me in the right direction. It's a shame this turned out to be a core file edit. That always leave a dirty taste in my mouth.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    That will work as well, but commenting out the line I pointed you to (specifically, the clean_url line) will eliminate this entirely, allowing you to use any protocol you like. I find this to be a much more suitable fix than simply adding protocols to that list.

    clean_url() does more or less what it says, it takes the URL you put in and attempts to clean it up. I dislike WordPress trying to second guess me there, and simply disabling that line prevents it from mucking with my URL at all (short of special character cleanup).

  5. haven1000
    Member
    Posted 6 years ago #

    My problem is that I write in an external link I want in a post in code but as soon as I switch to "visual" or "view site" WP has changed the link to point back to my own blog.

    Is this the same problem as you explained about the edit_link()function?

    If so, where do I find admin-functions.php so I can comment out that line 600?
    By comment out, do you mean adding: <!-- to start it and --> to end it?

    Sorry to be a deunce! I sure appreciate your help.

Topic Closed

This topic has been closed to new replies.

About this Topic