Support » Plugins » calling wp_logout() before get_header() doesn't logout before header processed

  • I am creating a custom logout page as part of my template, full code below. I anticipated that by calling wp_logout() before get_header() that when header.php is processed the user will be in a ‘logged out’ state and thus show the logged out elements, however this is not the case so obviously something else going on here?

    Any ideas?

    I need this mostly because i have a non-wordpress, .ASPX web page that will call my page to logout when the user finishes their activity .

     * Template Name: Custom Logout
     * A custom page template with sidebar.
     * The "Template Name:" bit above allows this to be selectable
     * from a dropdown menu on the edit page screen.
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
    <?php wp_logout(); ?>
    <?php get_header(); ?>
    <div class="box-traing">
    	<div class="box-traingb">
    		<div class="box-traingcontent" style="padding-bottom: 10px;">
    			<div id="left-tr" style="width: 925px">
    			<h2 style="margin-bottom:10px;"><?php the_title(); ?></h2>
    			<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    			<?php the_content(); ?>
    			<?php endwhile; endif; ?>
    <?php get_footer(); ?>
  • The topic ‘calling wp_logout() before get_header() doesn't logout before header processed’ is closed to new replies.