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

  • Home
  • SEARCH
  • 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 7586749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:30:11+00:00 2026-05-30T19:30:11+00:00

In a functions.php I use a redirect to show a profile page when a

  • 0

In a functions.php I use a redirect to show a profile page when a correct code is added to the homepage. It worked before, but ever since a third party coder added some changes it no longer does. I initially added an isset to remove a Undefined index: post_type error. Now there are no more errors, but instead of being redirected to the profile view I am being redirected to the final else statement: a 404. Here is the redirect code:

    function my_template_redirect()
{
    global $wp;
    global $wp_query;

    if (isset($_REQUEST['post_type']))

    { 
    if ($_REQUEST['post_type']=="signup")
    {
        // Let's look for the property.php template file in the current theme
        if (have_posts())
        {
            include(TEMPLATEPATH . '/register.php');
            die();
        }
        else
        {
            $wp_query->is_404 = true;
        }
    }else if ($_REQUEST['post_type']=="viewprofile")
    {
        // Let's look for the property.php template file in the current theme
        if (have_posts())
        {
            include(TEMPLATEPATH . '/viewprofile.php');
            die();
        }
        else
        {
            $wp_query->is_404 = true;
        }
    }
}
    }

Profile view code is here: http://pastebin.com/1Nkxp0Zv . Form code on home is:

<div class="container">
                    <form action="<?php echo get_option('home'); ?>/?post_type=viewprofile" method="post">
                    <span>Enter your code here:</span><input name="enterCodeId" type="text" class="inputBox" /><input type="submit" value="GO!" class="go" />
                    </form>
              </div>

Any ideas why my key is no longer accepted and keep on getting 404-ed via the last else statement?

  • 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-30T19:30:13+00:00Added an answer on May 30, 2026 at 7:30 pm

    Looks like the only way to get to that is by not having any posts, or if the have_posts() function returns a falsy value. That’s where you will find your error.

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

Sidebar

Related Questions

When I use file functions in PHP, I check for EOF. I wonder if
I want to use PHP to replace javascript functions in HTML documents. For example:
Is it possible to use PHP's SimpleXML functions to create an XML object from
I have a .NET DLL containing functions that I can use in PHP. Though
Using PHP's Image and GD functions you can use the following method to finally
Anonymous functions are available from PHP 5.3 . Should I use them or avoid
I use a javascript function on mobile page to redirect users to main page(pc).
Im very new in php and try to use cookie but it is not
I would like to get the redirect URL using cURL in PHP. The code
i'm a beginner to php. i need to use php function which process some

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.