Support » Plugin: Absolute Relative URLs » URLs in wordpress subdirectory have “/wordpress” removed

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author intuitart

    (@intuitart)

    Thanks for reporting this. One question before I set this up to test, are you using the classic editor or the newer block editor?

    Andrew P.

    Thread Starter spindles7

    (@spindles7)

    Thanks for getting back to me so quickly! I use the Classic Editor, mainly in text mode.

    Thanks.

    Spindles7

    Plugin Author intuitart

    (@intuitart)

    OK, what you are seeing is a result of one of the fundamental assumptions in how the plugin works. Both urls get removed when saving a post. The ~/wordpress url is re-inserted only for files in the uploads folder.

    So my next question is, what is your use case for linking to files outside the uploads folder? A custom application? Uploading images or documents manually outside of the media upload process?

    A possible workaround is to add a filter in functions.php to always use the ~/wordpress url when generating an absolute url for display. This can be done with the following:

    add_filter( 'of_absolute_relative_urls_url', function( $url, $wpurl ) {return $wpurl;}, 10, 2 );

    Hope this helps, and I am curious about your use case.

    Andrew P.

    • This reply was modified 1 year, 6 months ago by intuitart.
    Thread Starter spindles7

    (@spindles7)

    Ah, now I understand why some work and others don’t! Thanks for the explanation.

    The reason I linked to a file outside the uploads folder was beacuse I had created a “site” plugin which contains custom functions I had written specifically for my website (to prevent them being overwritten by upgrades etc) and was referencing a file in that plugin. In actual fact it’s an icon file, which can quite happily sit in the uploads path. So I will move these files into the uploads path and that will resolve this issue, and save me adding the filter.

    Many thanks for your timely and expert help.

    Regards,

    Spindles7

    Plugin Author intuitart

    (@intuitart)

    Sounds reasonable. Thanks for reporting the issue. The intent is that the plugin just work with minimal configuration, and most of the time it does that, but there are always edge cases…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘URLs in wordpress subdirectory have “/wordpress” removed’ is closed to new replies.