Viewing 15 replies - 1 through 15 (of 19 total)
  • I noticed the same problem. I can use the HTML editor rather than the Visual editor to fix the links. It is a cumbersome work-around for this problem.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Relative links are not recommended. They break whenever you change to using non-default permalink settings.

    I can see the valid argument for using absolute urls. But is there a way to disable the “forced absolute urls” in 2.5? It is proving cumbersome for editing older posts, and I would like to be able to stick with relative links at least temporarily.

    Actually I found a solution by looking in the code for the tiny_mce_config file.

    I replaced
    'relative_urls' => false,

    with
    'relative_urls' => true,

    Which allows me to do exactly what I wanted to do, and I can change it back later.

    Thread Starter eynugget

    (@eynugget)

    Hmm…

    Seems to me the absolute links make the site pretty non-portable.
    Well, that’s not too bad since we don’t change the location of the site all that often.

    The real problem is that, by default, it stuffs the “/wp-admin” thing in there and that breaks the reference.

    I have found that the workaround in the Visual Editor is to just modify each image src= to “../images/hello.gif”. This then gets changed to “https://www.mydomain.com/wp/images/hello.gif” and wordpress will not add the “/wp-admin” when saving.

    But, I have to do this to dozens images manually. Less cumbersome than circumambulant’s workaround.

    Thanks guitarnoise for this advice. For those who want to try it, guitarnoise was referring to the file wp-includes/js/tinymce/tiny_mce_config.php

    Unfortunately, this enforces relative links (and does not tolerate absolute links; or at least this is what I found). I am afraid it will only help some people.

    Personally, I’d appreciate it if the bug (adding wp-admin to relative links) was fixed. Besides, I guess I’ll once again have to resort to the non-visual HTML editor ??

    This is for Otto42:

    You said:

    Relative links are not recommended. They break whenever you change to using non-default permalink settings.

    This is not a decision that WP or TinyMCE should make, and it telling folks “Don’t do that” doesn’t help with their frustration.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    @schamane:

    Personally, I’d appreciate it if the bug (adding wp-admin to relative links) was fixed.

    Try adding this to that array in tiny_mce_config.php, see if it works:
    'document_base_url' => get_option('url'),

    If it does, I’ll see about getting it into trac.

    @skeezicks:
    It may not help with their frustration, but it will help them prevent problems in the future by using correct absolute URLs instead of relative ones. When they start using non-default permalinks and suddenly every link they’ve ever made breaks, well, then we have to tell them “yeah, you messed up originally, go undo all that work you’ve done for the last long time period”, then that’s a tad more frustrating, no?

    Relative URLs are tools of evil and should be avoided whenever possible.

    Circumambulent’s workaround about using the HTML editor worked for me (IIRC). Thanks for the help!!

    Then I began using TinyMCEAdvanced (supposedly fixed for WP2.5).

    Problem came back.

    I went through Schamane’s workaround for TinyMCE and will see how that works out for me (Thanks, Schamane!)

    I also checked whatever Tinymceadvanced files I could find for a similar callout but was not able to find any, so I guess it’s back to TinyMCE for awhile.

    To Otto42:

    First of all, thanks for your help. Please forgive my frustration. It just seems that I constantly have to fuss and fidget around with my blog to get it to work right.

    It’s like MSWord’s multi-level list functionality. No matter how much care one puts into formatting a multi-level list, it seems it is always boogered the next time the file is opened.

    A few months back, and in another forum (bluehost, I believe) I got the idea that the inclusion of absolute urls in blogs opened doors to spambots, and that keeping urls relative would help. That’s my big hangup with absolute vs. relative urls. Maybe whoever wrote that advice was incorrect, I dunno.

    Sometimes it seems that I spend much more time trying to prevent problems than I would spend just fixing the problems if and when they occur.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    A few months back, and in another forum (bluehost, I believe) I got the idea that the inclusion of absolute urls in blogs opened doors to spambots, and that keeping urls relative would help. That’s my big hangup with absolute vs. relative urls. Maybe whoever wrote that advice was incorrect, I dunno.

    I’ve never heard of that one before. I kinda see what they’re thinking, but it’s stupid.

    Basically, the idea here is that the spam bot isn’t able to turn bob/your/uncle.html into https://example.com/bob/your/uncle.html . However, the idea is incorrect because a) browsers can do it and b) so can mirroring program like wget and c) it’s literally like only 5 lines of string manipulation code to do it. One line of regexp. So thinking that it somehow prevent spambots from finding things is just straight up wrong and silly. Sorta like the silly idea that using “at” instead of “@” in email addresses fools email harvesters.

    Thanks for the clarification!

    The proper setting for tiny_mce_config.php is
    'convert_urls' => false,

    This will preserve the URLs as entered, either relative or absolute.

    Well, it works for me. Today anyway ??

    BTW, the workaround holds up also if one uses TinyMCEAdvanced.

    @otto42: 'document_base_url' => get_option('url'), does not work. I guess this is because while editing a post the current URL is https://myhost/sth/wp-admin/post.php.

    Thanks to azaozz. Since I prefer relative URLs anyway, 'convert_urls' => false, is what I was looking for. Strangely though, it works only if I also set 'relative_urls' => true,.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘relative URL converted to abs URL in Visual Editor 2.5’ is closed to new replies.