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

Bill Erickson bill.erickson at gmail.com
Tue Jul 3 14:34:42 UTC 2012

It's much easier to migrate a site with absolute URLs than it is with
relative URLs. Try using a script like this to update the URLs in the
database after you've moved it:

Bill Erickson
WordPress Consultant

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 Mon, Jul 2, 2012 at 10:11 PM, Casey Bisson <casey.bisson at gmail.com>wrote:

> Have you considered leveraging WP's native image/attachments and simply
> store the ID of the attachment? From there it's very easy to generate a URL
> on the fly with wp_get_attachment_url( $id ) . Of course you can then
> automatically get different sizes as well.
> Casey Bisson
> http://twitter.com/misterbisson
> On Jul 2, 2012, at 3:13 PM, Shasta Willson wrote:
> > A number of the plug-ins I use, such as sliders, involve inputting an
> > absolute URL for the image.  This is a problem at deployment (or any
> > other move) obviously, but I'm not sure I've seen it done any other
> > way.
> >
> > I'm building a custom type that includes two image uploads using the
> > built-in media box.  I'd really like it to store a relative URL rather
> > than an absolute one so I've considered using regex to just strip off
> > everything to "/uploads".  Is there a downside to doing this?  Is
> > there a better way to accomplish the goal?  Am I missing some reason
> > everyone seems to store the absolute link?
> >
> > Thanks,
> > Shasta
> > _______________________________________________
> > 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

More information about the wp-hackers mailing list