[wp-hackers] Site Address during development

Christopher Bratlien chrisbratlien at gmail.com
Thu Sep 2 14:51:22 UTC 2010


One solution which works for me is to put these 9 lines into functions.php
before I begin saving content during the dev phase:

function bsdrelative_content_replace_url($content) {
  return str_replace(get_bloginfo('url'),'[url]',$content);
}
add_filter('content_save_pre','bsdrelative_content_replace_url');

function bsdrelative_url_shortcode($atts, $content = null) {
  return get_bloginfo('url');
}
add_shortcode("url", "bsdrelative_url_shortcode");

This is also available as a plugin:
http://wordpress.org/extend/plugins/relative-site-url-on-content-save/

/end-self-promotion


On Thu, Sep 2, 2010 at 9:39 AM, Philip M. Hofer (Frumph)
<philip at frumph.net>wrote:

> Wouldn't you think that someone creating a quick loop of the posts with a
> str_replace('oldurl', 'newurl', $the_content);  then resaving the post each
> pass would be enough ?
>
> - Phil
>
>
> ----- Original Message ----- From: "Otto" <otto at ottodestruct.com>
>
> To: <wp-hackers at lists.automattic.com>
> Sent: Thursday, September 02, 2010 7:32 AM
> Subject: Re: [wp-hackers] Site Address during development
>
>
>
>  On Thu, Sep 2, 2010 at 7:36 AM, Michael Clark
>> <dc153464a11bcf5aeb18180db28017fb.wp-hackers at planetmike.com> wrote:
>>
>>> Actually, it seems silly to embed the domain name into the posts and
>>> pages
>>> at all. It's adding a bit to the page, plus possible delaying the loading
>>> of
>>> pages by fractions of a second as the page requests have to hit DNS.
>>> Shouldn't everything embedded be relative to the root directory of
>>> WordPress? Thanks, Mike
>>>
>>
>> 1. Browsers cache DNS requests. So do operating systems.
>>
>> 2. Your content isn't only displayed on the website. Feeds can contain
>> it too. And relative URLs don't work there.
>>
>> -Otto
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Chris Bratlien
I write code (so you don't have to)
 http://chrisbratlien.com | 1-979-229-5685 | Skype: chrisbratlien


More information about the wp-hackers mailing list