I'm encountering a problem that involves that my Admin bar doesn't show the "Edit Page" on pages I visit on my site. Instead for some odd reason it show "Edit Category" instead on supposed page.

Does anyone know what might cause this? I checked on another thread about putting

<?php wp_reset_query(); ?> in the footer.php but this didn't work for me.

I did it like this:

<?php endif; ?>
<?php wp_footer(); ?>
<?php wp_reset_query(); ?>

Update: I forgot to mention, that I first created a template which was a copy of another one, the only change was that it called a different function. That function was a copy from another, basically what it did was how much text it showed in a post. I also created a different loop.php(named loop2.php) so it could work with this template. So the conclusion of this was that you could choose now a new different template for your page (imagine that the original name was: template and I created template2.

The changes in query.php for the function wp_reset_query() which I did after the bug emerged was:


function wp_reset_query() {

    $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];


function wp_reset_query() {
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];


I read somewhere on a forum that unset($GLOBALS['wp_query']); would help me..

Update #2: The code for the original template:

    Template Name: Blog List
    <?php get_header(); ?>
<div class="content-wrap">
    <div class="content">
        <?php tie_breadcrumbs() ?>

        <?php if ( ! have_posts() ) : ?>
            <div id="post-0" class="post not-found post-listing">
                <h1 class="post-title"><?php _e( 'Ej hittad', 'tie' ); ?></h1>
                <div class="entry">
                    <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?></p>
                    <?php get_search_form(); ?>
        <?php endif; ?>

        <div class="page-head">
            <h1 class="page-title">
                <?php the_title(); ?>

        <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
        <?php $get_meta = get_post_custom($post->ID);  ?>
        <?php tie_include( 'post-head' ); // Get Post Head template ?>  
        <div class="entry"><?php the_content(); ?></div>
        <?php endwhile; ?>

        <?php //Above Post Banner
        if( empty( $get_meta["tie_hide_above"][0] ) ){
            if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'</div>';
            else tie_banner('banner_above' , '<div class="ads-post">' , '</div>' );

        <?php $cat_query = '';
        if ( !empty( $get_meta["tie_blog_cats"][0] ) ) $cat_query = '&cat=' . $get_meta["tie_blog_cats"][0] ; ?>
        <?php query_posts('paged='.$paged.'&posts_per_page='. $cat_query); ?>
        <?php get_template_part( 'loop', 'category' );  ?>
        <?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>

        <?php //Below Post Banner
        if( empty( $get_meta["tie_hide_below"][0] ) ){
            if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'</div>';
            else tie_banner('banner_below' , '<div class="ads-post">' , '</div>' );

        <?php comments_template( '', true ); ?>
    </div><!-- .content -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

As I mentioned in the text I did a copy of this one to create a second template.. The copy used a different function. So instead of the_content(); it used blog(); which was a copy of the_content(); except that it had a different value, the value determined how much text it would show in a post in my site.

  • 1
    If for some reason you're messing with the main query, you'd need to wp_reset_query() before wp_footer(), since the adminbar script outputs at wp_footer(). That said: can you please provide more context? What is the code that is impacting the main query? What is the context: is this a custom page template? Jan 23, 2014 at 13:02
  • I did an update on the case if you're interested @Chip Bennett Jan 23, 2014 at 13:42
  • Wait: you're modifying core files? Don't do that. Ever. Also, please include your actual template code, as relevant. Jan 23, 2014 at 13:46
  • Template code included, thanks for your time! @Chip Bennett Jan 23, 2014 at 14:06

1 Answer 1

  1. Undo your core-file change
  2. Replace query_posts() with a proper call to new WP_Query() for your secondary query loop.

Your admin bar issues will auto-magically disappear.

  • Hmm, this will be the first time for me doing this so.. could something like this work?: <?php $query = new WP_Query( 'post_type=any' ); ?> @Chip Bennett Jan 23, 2014 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.