[wp-hackers] absolute URLs in plug-ins and custom types

Bill Erickson bill.erickson at gmail.com
Wed Jul 4 21:57:10 UTC 2012


Ah yes, if you're making links inside your theme/plugin, definitely don't
hardcode the URLs. You can use the code you mentioned, or <?php echo
home_url( '/whatever' );?>


---
Bill Erickson
WordPress Consultant
http://www.billerickson.net

NOTE: To better serve my clients, partners, and most importantly my family,
I've begun checking email only three times per day.

For phone calls, please schedule here: http://tungle.me/billerickson . If
it's an emergency, please call now and leave a voicemail



On Wed, Jul 4, 2012 at 4:54 PM, Shasta Willson <shastaw at gmail.com> wrote:

> On Wed, Jul 4, 2012 at 12:55 PM, Otto <otto at ottodestruct.com> wrote:
> >
> >> Uh..no..that's what relative URLs are specifically for.
> >
> > So, a URL of /2012/07/whatever will still work when you move it to
> > /blog/2012/07/whatever? (Hint: nope.)
>
> I'm not using the terms properly.  When I said "relative", I really
> meant I code something like this:
>
> <a href="<?php bloginfo('url') ?>/whatever">
>
> Which is NOT a relative URL once rendered, but does update if I change
> the site settings, as opposed to the plug-ins which require you to
> input a URL like this:
>
> http://testsite.com/wp-content/uploads/2012/01/cover.jpg
>
> Now that I understand there are other things that are absolute AND
> thanks to Bill I understand why I've had trouble with prior DB search
> and replace operations, it makes sense that that's the right way to
> handle moves. I rarely work with moving live content, but recently had
> a site with posts and thought I'd done something wrong when I had to
> fix all the images.
>
> Thanks folks!
> Shasta
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list