Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to be able to edit a Page or Post that I'm on in Wordpress rather than go to the admin panel on left and find the page or post.

I somehow think it used to be there, but when I navigate to a page, it's not in the Top Admin Menu options.

share|improve this question
    
It should be there by default if you are viewing a single post or page –  Bainternet Jul 19 '11 at 5:24
    
yeah, it's strange. I remember it being there, but maybe I turned it off somehow? –  dreamgrowers Jul 22 '11 at 16:58
    
I think there must be a plugin that disabled Edit Page from the Top Admin bar. Any ideas on where to track it down? We have dozens of plugins so I'd like not to remove one by one. –  user9066 Oct 8 '11 at 6:55
    
This fixed it for me http://core.trac.wordpress.org/attachment/ticket/16798/16798.2.patch –  user10172 Nov 10 '11 at 12:58
add comment

6 Answers

Typically most themes will include an edit link on the post/page itself that takes you directly to the backend to edit the post. If not, you can always add it yourself with code similar to the following in single.php, page.php, etc.:

<?php edit_post_link('(Edit this post)', '<p>', '</p>'); ?>

(See http://codex.wordpress.org/Function_Reference/edit_post_link for more details.)

Also, check out some of the in-place editing plugins that exist such as Front-end Editor that allow you to modify posts without even entering the backend editor.

Update:

Theoretically, you could manually add the link to edit pages in manually using code similar to the following. This may be necessary due to the bug mentioned here in the comments.

function my_admin_bar_link() {
    global $wp_admin_bar;
    global $post;
    if ( !is_super_admin() || !is_admin_bar_showing() )
        return;
    if ( is_single() )
    $wp_admin_bar->add_menu( array(
        'id' => 'edit_fixed',
        'parent' => false,
        'title' => __( 'Edit This'),
        'href' => get_edit_post_link($post->id)
    ) );
}
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_link' );

This can be added to your theme's functions.php. This is untested, but the idea is sound. May still be affected by the same bug.

share|improve this answer
    
So I've checked and it's up there in the Admin Bar with a fresh install so I much have turned it off somehow. Any thoughts on how I might turn it back on? –  dreamgrowers Jul 22 '11 at 20:50
1  
It's basically just turned off of the Default Top Admin Bar and I can't figure out how to turn it back on. –  dreamgrowers Jul 23 '11 at 22:53
1  
Hmm, I looked at it on a couple of my blogs and noticed similar behavior. As far as I can tell, it's actually a bug (see #16798 in WP Trac) related to running a query_posts() on the page. Very odd. –  Joshua Jul 25 '11 at 1:52
    
So would I just copy that exact code and put anywhere in the functions.php? –  dreamgrowers Jul 26 '11 at 9:41
    
I added the function, but didn't see any change... sinc'e it's supposed to be there, I'd really like to get the edit page/post back to the admin bar instead of a plugin that can cause some weirdness at times. –  dreamgrowers Jul 26 '11 at 10:45
show 1 more comment

http://annoyances.twentygrand.net/2011/08/23/wordpress-edit-this-page-links-and-admin-bar-not-showing-up/

---> make sure that you set the same URL for the “WordPress address (URL)” and “Site address (URL)” and voila, here's your top admin bar!

share|improve this answer
add comment

If you go to your users/profile page, click on the main user, and then you can select if the admin bar is shown while you are viewing site/in dashboard or both. By selecting "viewing site" you will be able to see the bar again.

share|improve this answer
    
Thanks for the idea Kate! The Admin Bar is there, but the Menu for editing a page /post disappeared! Not sure how and not sure how to get it back.... –  dreamgrowers Aug 1 '11 at 5:00
add comment

I am having the same problem.

Yeah according to the link to the bug issue above... the user suggests that the problem is in using query_posts() function on the post page (found within the theme). This somehow triggers wordpress to think that you're editing a category. It sort of makes sense but the suggestion there is to use the get_posts() function instead, which DOES fix the problem. Edit Post link shows However, get_posts() function does not work the same as query_posts and doesn't work for what I need.

I think it might be a bug and for now would take the suggestion of using the edit_posts_link() function for the time being. It's annoying, I agree but so far havent found another solution.

share|improve this answer
    
I also should say that the add_action function suggested did work for me. So there's that as well. –  mrs.d Aug 6 '11 at 1:23
    
Oh, I'd like to try that. So what code are you putting where exactly? –  dreamgrowers Aug 9 '11 at 8:55
add comment

Adding wp_reset_query() to the bottom of the page fixed it for me!

share|improve this answer
    
How did resetting the query work for this problem? –  Nicole Nov 9 '12 at 15:52
add comment

I've had this very same problem, it was bugging for ages, I even came to this page to find a solution and then it hit me.

You just need to reset the query at the bottom of the page using

wp_reset_query();
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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