Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6951259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:11:47+00:00 2026-05-27T14:11:47+00:00

Got a problem that I’m having a hard time getting started on. Not a

  • 0

Got a problem that I’m having a hard time getting started on. Not a big PHP guy so not sure where to start really.

What I have is this. I have a web application running on app.xxx.com this. This is our private application that all our customers use.

We are putting together a knowledge base in wordpress of how our software works, help files, etc… this is private information. For business reasons this wordpress runs on kb.xxx.com and must be there.

What I am doing currently is when a user authenticates at app.xxx.com I am setting a domain level cookie with some authentication information. This works great.

What I need to have happen is on the wordpress side of things if a user browses to kb.xxx.com and does NOT have our parent domain cookie, they are sent to a security error url somewhere. This has to happen server side, can’t do this in JS because its not secure enough.

What files would I edit in the wordpress install to do this kind of check for every request? Also how do I check for a parent level cookie in PHP.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:11:47+00:00Added an answer on May 27, 2026 at 2:11 pm

    Try this WordPress Action

    You can try this method. Just add the name of your cookie and add this code to your Functions.php file, located at the root of your theme file. If is not there you can just create one.

    Paste code into your Functions.php file

    function has_auth_cookie(){ 
        // See if cookie is set
        if(isset($_COOKIE['cookie_name'])){
            // Do nothing 
        }else{
            // Do Something else
            header('Location: http://www.example.com/');
        }
    }
    add_action('template_redirect', 'has_auth_cookie');
    

    Conclusion

    WordPress has a great Action and Filter system which makes adding code easy as cake. By using the filters and actions you can keep your code nice and clean instead of throwing PHP all over your template files. This method will survive WordPress core updates as well. Which is the only way to go if your using WordPress.

    Here’s the list of available actions for WordPress you can try instead of ‘template_redirect’:
    http://codex.wordpress.org/Plugin_API/Action_Reference

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the problem that the UIAlertViewDelegate method - (void)alertViewCancel:(UIAlertView *)alertView is not called
I got the problem that the if-statement doesn't work. After the first code line
I'm a newbie on Java EE and got a problem that I don't understand
I've got a little problem that's slightly frustrating. Is it possible to set a
I've got a pretty minor problem that I think can be resolved by re-thinking
I am running into a problem that just doesn't seem right. I've got a
I've got a problem about onbeforeunload recently that I need to pop up a
I've got a problem here with an MSI deployment that I'm working on (using
http://www.linkmanagementgroup.com/ My problem is that i've got the log in on the Front Page
I've got a problem with inheritance and generics. This is the code that illustrates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.