Displaying images with relative paths in the editor

By default it seems the editor inserts images using an absolute path.

We’re developing a site in /staging/ and plan to move it later on. Is there a way to get relative paths on images to display properly in the editor? Maybe there’s a function or snippet in the editor that resolves to the upload path or something?

Read More

So for example, my images in my home page are:

<img class="alignnone size-full wp-image-21" title="Authentic Chinese Food" src="wp-content/uploads/2011/04/panel_authentic.jpg" alt="Authentic Chinese Food" />

which display fine on the page itself, but not in the editor.

Thanks!
John.

Related posts

Leave a Reply

1 comment

  1. I had a client ask for that and it took a little while to get it but its simple:

    function change_mce_path_options( $init ) {
     $init['relative_urls'] = true;
     $init['document_base_url'] = get_bloginfo('url');
     return $init;
    }
    add_filter('tiny_mce_before_init', 'change_mce_path_options');