[wp-hackers] absolute URLs in plug-ins and custom types
    "Matthias P. Würfl" 
    mpw at taquiri.de
       
    Fri Jul  6 14:37:52 UTC 2012
    
    
  
Am 06.07.2012 15:50, schrieb Fabien Quatravaux:
> Le 06/07/2012 14:00, wp-hackers-request at lists.automattic.com a écrit :
>> I solved this with a small plugin that uses output buffering and
>> search/replace.[...]
>> Matthias
> Dear John, I would be _very_ interested if you could share this little 
> plugin. It could save me some headache 
C'est moi, "Matthias" :-)
It's just:
add_action('wp', 'ws_set_up_buffer', 10, 0);
function ws_set_up_buffer(){
     if ( is_feed() || is_admin() ){
         return;
     }
     ob_start('tq_repair_output');
}
function tq_repair_output($str) {
     $str = 
str_replace("http://wrong.domain.example","http://right.domain.example",$str);
     return $str;
}
It's a bit more, but the rest is specialized on our situation (multiple 
configs, clean svn co & updates, etc.)
Grüße, Matthias
    
    
More information about the wp-hackers
mailing list