Support » Fixing WordPress » Where I am in the site? parsing http_request

  • Resolved ELAN42.com

    (@nokao)


    Hi… does someone know where wordpress parses the http_request of the client?

    I’d like to have the first “folder”, for example if my website is http://www.nokao.com and a client is on http://www.nokao.com/blog/ I want the “blog” string.

    Actually to know where I am I do a very complicate if-else block with categories and pages tag-functions, but honestly I think it’s a loss of server-memory…

    Otherwise, I need to know how to get the CATEGORY/MOTHER_PAGE I’m in, without using stupid recursive functions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • If all you’re trying to figure out is what is in the user’s address bar, you don’t need a WP function. PHP will do that for you. Try one of these variables. If the user visits ‘http://www.example.com/blog/folder?p=3’ then…

    $_SERVER["REDIRECT_URL"] == '/blog/folder';
    $_SERVER["REQUEST_URI"] == '/blog/folder?p=3';
    $_SERVER["HTTP_HOST"] == 'www.example.com';

    Take your pick.

    Yes, I knew, but I suppose that WP parses that somewere…

    My intention was to not parse it again… with the risk of doing errors e/o using useless server resources.

    Is there another solution?

    Ahh. If I’m understanding you correctly, I think you’ll find your answer here:

    WP_Query

    Thank you 😉

    Perfect.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Where I am in the site? parsing http_request’ is closed to new replies.