[wp-hackers] Any alternative to $_SERVER['QUERY_STRING'] for SEO friendly URLs?..

dave jaggy jayarjo at gmail.com
Sat Dec 27 07:43:08 GMT 2008


I also want it to be independent of the permalink structure. I mean I
want the plugin to work despite of what structure (nice or not nice)
is selected by user. I think there's just has to be some translation
method between URIs... I know $_SERVER['REQUEST_URI'] should work, but
id will be some kind of semi-workable, I mean it will work only on
usual URIs or only on nice ones. That's my main problem.

On Sat, Dec 27, 2008 at 11:34 AM, DD32 <wordpress at dd32.id.au> wrote:
> It depends on where you're hooking in.
>
> the wp_query vars are not loaded straight up, But if you're running on a
> hook of some sort, something like this would work:
>
>
> add_action('template_redirect', 'fff');
> function fff() {
>    $ident = md5(serialize($GLOBALS['wp_query']->query_vars));
> }
> Alternatively, You could base it off $_SERVER['REQUEST_URI'] which once WP
> has started loading, should contain the current permalink structure (ie.
> /posts/1234/blahblah-blah/) Concat that with $_SERVER['QUERY_STRING'] and
> you'll have something that'll definately be unique:
>
> $ident = md5($_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'])
>
> 2008/12/27 dave jaggy <jayarjo at gmail.com>
>
>> Thank you for your responses.
>>
>> I'm not yet acquainted with wp_query syntax. Is there some good
>> resource around, for me to have a look before I plunge into API
>> directly?
>>
>> I just need some unique identifier for every page in wordpress, no
>> matter will it be a post, page, category, tag or any other one
>> possible.
>>
>> Thank you for your time again.
>>
>> On Sat, Dec 27, 2008 at 4:52 AM, Mike Schinkel <mikeschinkel at gmail.com>
>> wrote:
>> > Just curious, what exact value are you looking for from
>> > $_SERVER['QUERY_STRING']?
>> > Or more importantly, can you post the code that you are using that
>> queries
>> > $_SERVER['QUERY_STRING'] and explain in comments what values you are
>> looking
>> > for any why you need them?  If so, we might be able to give you another
>> way
>> > to do what you need to do.
>> > -Mike
>> > On Fri, Dec 26, 2008 at 8:23 AM, dave jaggy <jayarjo at gmail.com> wrote:
>> >
>> >> I'm writing plugin, which heavily depends on the current url. It's ok
>> >> when everything is set to default and I got usual query_string uri's.
>> >> But when I switch on SEO friendly urls, my plugin stops working. Or in
>> >> other words $_SERVER['QUERY_STRING'] on which I base my switch()
>> >> syntax becomes empty. Is there any alternative for SEO friendly urls?
>> >> Maybe components of the permalink got dumped in some structure
>> >> somewhere in WP's global space? Or something else?..
>> >>
>> >> Dave
>> >> _______________________________________________
>> >> 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
>> >
>> _______________________________________________
>> 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
>



-- 
David Barbakadze

System Administrator
IT Development Center
www.itdc.ge
Tel.: (+995 32) 996118 ; (+995 32) 509049
Fax.: (+995 32) 996118


More information about the wp-hackers mailing list