I had to add a query on the end of my URL, like this:
http://www.somewordpressite.com/?page_id=57?login=failed
Now I need to check if '?login=failed' exists, so I can load the correct piece of a template.
I have tried a bunch of variations, but I just can't seem to grab it.
<?php
$checkurlquery[] = $_SERVER['QUERY_STRING'];
//echo json_encode($_GET, JSON_HEX_TAG);
foreach($checkurlquery as $key => $v){
$dice = $checkurlquery[$key];
echo ($dice);
}
?>
Result: page_id=57?login=failed
Ultimately, I'm just trying to get to here:
if ( //LOGIN failed )) {
get_template_part( 'login', 'failed' );
} else {
get_template_part( 'login', 'form' );
}
How can I check for login=failed, so I can use it to load the right template part? Thanks.
Edit: Yes, I was able to change the URL, so it can be: http://www.somewordpressite.com/?page_id=57&login=failed, but it created an issue. Because Wordpress uses that '?', then if I am on the home page, and fail at login, I get a 404 error:
This URL is ok and grabs the index page:
www.site.com/?login=failed
This URL is a 404 error:
www.site.com/&login=failed
Edit: Here is the updated function necessary in Wordpress functions.php: Redirect after login, Wordpress URLs
Then in header.php (or place of your choice), add:
<?php
if(isset($_GET['login']) === true and $_GET['login'] === 'failed')
{
get_template_part( 'login', 'failed' );
} else {
get_template_part( 'login', 'form' );
}
?>
?