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.

Can someone please assist with how to remove from my theme, whilst in author mode, the edit_post_link (Edit link), throughout all my pages. Which php files in the Twenty Eleven theme (WordPress v3.2) do I need to comment out to no longer display this edit link?

I realise that you only see this during author mode but would like to know how to remove altogether.

Thanks.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

It's the edit_post_link() function. You'll find lines like the following, that you need to comment out:

// from /twentyeleven/content-intro.php
edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' );
share|improve this answer
add comment

One way is to edit the template files of your theme, as you mentioned in your question you are using Twenty Eleven, so you can follow the advice of @kaiser.

The other way that I will prefer instead of modifying the template files is to use the filter. The advantage of filter is it will work with other themes too. The disadvantage of filter is that you will have empty <span></span> tags in your html source, though they won't be visible on the actual page.

You can put the following code in your functions.php.

function wpse_remove_edit_post_link( $link ) {
    return '';
}
add_filter('edit_post_link', 'wpse_remove_edit_post_link');

P.S you can use the filter to disable the edit post link on selective posts too.

share|improve this answer
3  
Or just use add_filter( 'edit_post_link', '__return_false' ); :) –  kaiser Jul 11 '11 at 15:34
    
Would add_filter( 'edit_post_link', '__return_null' ); be more appropriate than false? –  jb510 Nov 19 '13 at 2:25
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.