Deze plugin is niet getest met de laatste 3 grotere versies van WordPress. Mogelijk wordt het niet meer onderhouden of ondersteund. Ook kunnen er compatibiliteitsproblemen ontstaan wanneer het wordt gebruikt met recentere versies van WordPress.

Absolute-to-Relative URLs


If you were to use this on a website like http;//, you would get results like these:

    • Before: http;//
    • After: ../another-test/#anchor
    • Before: http;//
    • After: /wp-content/themes/twentyten/style.css
    • Before: https;//
    • After: https;//
    • Before: http;//
    • After: //
    • Before: ../../../../../../../../#anchor
    • After: /#anchor
    • After ($output_type=1): ../../#anchor

All string parsing. No directory browsing.

If you’re looking for a plugin that will automatically convert all URLs on your WordPress site, instead check out my other plugin, WP-HTML-Compression.
Before you copy this code and add it into your own, keep in mind that there will probably be future updates. Keeping the code within an installed plugin will make sure that you’re notified.


  1. Download the plugin (zip file).
  2. Upload and activate the plugin through the “Plugins” menu in the WordPress admin.


Why isn’t this automatic?

Check out WP-HTML-Compression instead.

How does this work?

Just use absolute_to_relative_url($url).

Will this plugin work for WordPress version x.x.x?

This plugin has only been tested with versions of WordPress as early as 3.2. For anything older, you’ll have to see for yourself.


Er zijn geen beoordelingen voor deze plugin.

Bijdragers & ontwikkelaars

“Absolute-to-Relative URLs” is open source software. De volgende personen hebben bijgedragen aan deze plugin.


Vertaal “Absolute-to-Relative URLs” naar jouw taal.

Interesse in ontwikkeling?

Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.



  • Empty, hash-only anchors ("#") are no longer invalidated to "/"


  • JavaScript URIs ("javascript:") are no longer invalidated as paths


  • Data URIs ("data:") are no longer invalidated as paths


  • Domains with and without “www.” are no longer considered to be identical by default, but can still be overridden


  • Scheme-relative URLs (// now supported on input and output
  • Cleans up the ports and paths of external URLs
  • Optionally, output only host-relative URLs (/root-dir/)
  • Speed optimizations
  • Minor bug fixes


  • Path-relatve URLs (../), or parenting, now supported on input and output
  • Differentiates schemes/protocols, usernames, passwords, hosts, ports, paths, resources/files, queries and fragments/hashes
  • Considers domains with and without “www.” to be identical, and can be overridden
  • Outputs the shortest url (host- or path-relative) by default, and can be overridden
  • Custom site URL support, but only with a separate new Absolute_to_Relative_URLs() instance


  • Initial release