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

Bryan Petty bpetty at bluehost.com
Fri Jul 6 14:29:52 UTC 2012

On 07/06/2012 07:51 AM, Mika A Epstein wrote:
> Ryan - All that felt like just an epic ton of work to solve something that I didn't feel was a problem ;)
> I don't like reinventing the wheel, or complicating my code to make something 'simpler' for a user who has to remember to do [home]\whatever\url - Telling them 'Put the whole URL in, http://domain.com/foobar for example' is easier, it's consistent, and it always works on any site they ever go to. Less to untrain the novice (dad) later.
> The only person a shortcode or filter might help is the dev, and the dev already knows what to search/replace on anyway.

I wish it wasn't a "problem", but I have to call it one when I'm
constantly "fixing" it with every blog that needs moved, or started out
on a development server without hijacking the official, final hostname.
This is something that has always bothered me, and obviously bothers
several more people here with the same problem.

A search/replace performed on the entire database is a dangerous
operation for anyone that doesn't know the blog inside and out enough to
know what it could affect and what shouldn't be changed. It definitely
isn't something I would be advising the same WordPress users to perform
that can't figure out how a simple shortcode works.

Anyway, the idea here is that most of the time, the editor would be
pasting these shortcodes in automatically when the author picks out
something from the media library. Between that and filtering content on
save to replace any manually copied URLs, this problem could be solved
altogether without any authors needing to know anything about the syntax
of the shortcode, or how it works.

As an added bonus, this would make it easy to change the permalinks
structure without breaking links to other posts within another post's
content as well.

Bryan Petty
WordPress Developer
bpetty at bluehost.com

More information about the wp-hackers mailing list