0

I am having an issue with accessing my WP-Admin on my Wordpress site. I keep getting this message:

"Parse error: syntax error, unexpected 'return' (T_RETURN) in /home/rugguru/public_html/wp-includes/pluggable.php on line 1173".

Any solutions? Below is the code on line 1173.

$status = apply_filters( 'wp_redirect_status', $status, $location );

if ( ! $location )
    return false;

$location = wp_sanitize_redirect($location);

if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
    status_header($status); // This causes problems on IIS and some FastCGI setups
header("Location: $location", true, $status)
return true;

} endif;

1 Answer 1

1

Your header line is missing a semi-colon. It may not be the line producing the error, but I'd start with that :)

header("Location: $location", true, $status);

Here's what I meant in the comments, about the if statement

if ( ! $location )
    return false;

$location = wp_sanitize_redirect($location);

if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ): // note the colon
    status_header($status); // This causes problems on IIS and some FastCGI setups
    header("Location: $location", true, $status);
    return true;
endif; // no } necessary

or you could do this

if ( ! $location )
    return false;

$location = wp_sanitize_redirect($location);

if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
{
    status_header($status); // This causes problems on IIS and some FastCGI setups
    header("Location: $location", true, $status);
    return true;
}

if neither of these are what you are aiming for, I can only assume the endif belongs to another if statement outside of the scope of code you included...

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the response @Dale. Still yielding the same results after correcting that error. Any other ideas what may be the issue? Here's my code again: $status = apply_filters( 'wp_redirect_status', $status, $location ); if ( ! $location ) return false; $location = wp_sanitize_redirect($location); if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ) status_header($status); // This causes problems on IIS and some FastCGI setups header("Location: $location", true, $status); return true; } endif;
It looks like your mixing up two methods of doing an if statement, which if statement are you intending the endif; to be completing? Judging by the indent on the line after each if, it looks like it belongs to neither. I wonder if you meant for the second if statement to continue by using a colon (:) after it? Try the update above, I'll edit my answer to show what I mean.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.