• The current version of CFT has a drastically different TinyMCE editor (main issue is the noticeable lack of a hyperlink button, but that’s not the main issue I’m posting about here). Currently, the only way to add a link to a TinyMCE field is to toggle to html and insert the code manually.

    HOWEVER, when I do so, it is converting my links from absolute ones to relative to the wp-admin, and so when the post is actually published the links are broken.

    Example, inserting a link:
    http://www.mysite.com/2014/04/title-of-post.html

    Becomes:
    ../2014/04/title-of-post.html

    Even if I try to do a relative link manually, entering it as “/2014/04/title-of-post.html” it still adds the “..” thereby breaking the link.

    This is HUGE deal as it essentially renders all inner-site links useless. HTMLEditor fields are fine, and changing TinyMCE fields to HTMLEditor fields seems to be the only solution at the moment (not ideal) as I cannot get these links to work otherwise. Please address this issue ASAP!

    https://wordpress.org/plugins/custom-field-template/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Having the identical issue.

    We have debugged this issue in our clients WordPress and here are our findings in case it helps anyone.

    Issue happens when tinymce on other rte(page description) is set to text mode.

    It happens only when no other richtext editor are enabled on page.

    Eg: If the page description content area mode is set as text,

    wp first init config which sets relative_urls: false, convert_urls:
    false, remove_script_host : false are not run.

    custom template plugin just uses addmceeditor() command which uses the default tinymce settings where relative_urls, convert_urls, remove_script_host are true.

    To fix this, have to set the tinymce settings in the plugin before the addmceeditor() command, so it will work correctly even when other richtexteditors are not enabled on the page.

    Ref: http://awesomescreenshot.com/0ed36czkb6

    Here is how we decided to fix it:

    file: wp-content/plugins/custom-field-template/custom-field-template.php

    line 2189:

    $load_tinyMCE = 'tinyMCE.execCommand('."'mceAddEditor'".', true, "'. $textarea_id . '");';

    changed to

    $load_tinyMCE = "tinyMCE.init({'convert_urls': false, 'relative_urls': false, 'remove_script_host': false});";
    $load_tinyMCE .= 'tinyMCE.execCommand('."'mceAddEditor'".', true, "'. $textarea_id . '");';

    If anyone needs us to apply this for them contact us:
    http://www.weismannweb.com/services/specialties/wordpress

    Thread Starter purrdesign

    (@purrdesign)

    Thanks. Any way to do this via the theme functions file? I’d like it to be upgrade friendly.

    No problem.

    I don’t think there is a way to hook into another plugins execution unless that plugin provider creates hooks in their plugin for some other reason. In some cases it might be possible to hook into a core wordpress hook before/after the execution of the method you want to modify but in this case I don’t think it will work.

    I could be wrong but it is beyond our requirement to research it. I expect the plugin developer will make a fix for this in a future release. If he does not by the next couple of releases I will consider a better upgrade friendly solution if it is at all possible. Meanwhile we will just always re-apply the code on updates.

    Thread Starter purrdesign

    (@purrdesign)

    I just tried updating the code in the plugin and it doesn’t seem to resolve this issue. Links entered into the tinyMCE fields are still stripped and converted into relative links to the admin, this breaking them on the frontend.

    HOWEVER, I’ve just discovered that the issue ONLY occurs when the weird TinyMCE toolbar appears, and that is when I am editing the main post in Text mode. If I switch to visual and save, then the TinyMCE toolbar match the wordpress one and the links seem to retain their absolute structure.

    I can’t figure out why there are two different TinyMCE toolbars in the first place, but I guess if I could figure out how to get rid of the weird one (the one with the “File/Edit/View/Formats” on the top row) this would no longer be an issue…

    I’m having the same issue. I have updated the code provided by weismannweb, it no longer inserts relative links in the text area, though I have to re-insert the image in the visual editor.

    I’ve noticed however, I’m no longer able to save when I use the “toggle” feature to go from visual to text mode. In visual mode, I can make changes and save them, and they stick, but if I go to text mode, changes immediately revert back to what ever they were when I opened the page.

    Also I’ve noticed in the visual mode that images no longer have the little edit icons that appear on hover. Normally there’s a little pencil icon that opens up the same dialogue as the media uploader, allowing you to edit the size, title, and alignment of the image inserted into the text. This simply doesn’t show up now. Switching to text would allow me to alter those manually but of course as I mentioned, doing so doesn’t allow me to save. I’m assuming there’s just something in TinyMCE that’s not firing off properly to create this issue. I have to pop over to visual and completely re-do any inserted images to get it to save properly, which is pretty time consuming. Any help would be greatly appreciated.

    Unrelated to the bug however I strongly encourage everyone to switch to this plugin instead: http://www.advancedcustomfields.com/

    More user friendly and most importantly it works!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘TinyMCE fields and broken links’ is closed to new replies.