WordPress.org

Ready to get started?Download WordPress

Forums

calling wp_logout() before get_header() doesn't logout before header processed (1 post)

  1. sporty
    Member
    Posted 3 years ago #

    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 http://www.mydomain.com/logout to logout when the user finishes their activity .

    <?php
    /**
     * 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; ?>
    			</div>
    		</div>
    	</div>
    </div>
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic