I have the following code:
function wp_logout_url($redirect = '') {
$args = array( 'action' => 'logout' );
if ( !empty($redirect) ) {
$args['redirect_to'] = urlencode( $redirect );
}
$logout_url = add_query_arg($args, site_url(wp-login.php', 'login'));
$logout_url = wp_nonce_url( $logout_url, 'log-out' );
return apply_filters('logout_url', $logout_url, $redirect);
}
But I get the following error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
How can I fix this?