Ok i was setting add_action( ‘init’, ” ); twice
i have now changed it to –
// inject session header
function init_web_header(){
include web_plugin_dir . '/pages/web-session.php';
}
// SSO callbacks
function web_sso_callback() {
global $wp_rewrite;
$plugin_url = plugins_url( 'authcallback.php', __FILE__ );
$plugin_url = substr( $plugin_url, strlen( home_url() ) + 1 );
// The pattern is prefixed with '^'
// The substitution is prefixed with the "home root", at least a '/'
// This is equivalent to appending it to <code>non_wp_rules</code>
$wp_rewrite->add_external_rule( 'authcallback.php$', $plugin_url );
}
// init functions
function web_init_action(){
init_web_header();
web_sso_callback();
}
add_action( 'init', 'web_init_action' );
so session seems to now be ok but the wp_redirect again is not working. I dont seem to be able to get both to work together for some reason
And within web-session.php i have –
$location = $authsite . $authurl
. '?response_type=code&redirect_uri=' . $redirect_uri
. '&client_id=' . $client_id . '&scope=&state=' . $state;
wp_redirect( $location );
Really appreciate all the help you are giving as I am very very new to WP. All the codes works in pure PHP so i know it works outside of WP