Remove edit button (9 posts)

  1. CraigIW
    Posted 3 years ago #

    How can I remove the edit button from all or even a single page?

    I am running a members-only site, so to access a lot of functionality everyone has to be logged in. This is fine for most users as they don't see the edit button, but for the admins it's very annoying to have it there on all pages as it gets in the way visually of a lot of plugin functionality such as calendars, chat windows, etc. I really don't need or want this inline edit button on my site pages. How can I remove it?

  2. alieneila
    Posted 3 years ago #

    Your theme should be putting that link in there using the edit_post_link() function. You can edit your template files to remove it.

  3. CraigIW
    Posted 3 years ago #

    My page says it is using the 'Default Template' in twentyeleven. Do you know which php file that is? I don't see a default.php


  4. alieneila
    Posted 3 years ago #

    In TwentyEleven there are 12 files that use edit_post_link(... but the 3 you probably only want to worry yourself with are...

    /content-page.php line 21
    /content-single.php line 52
    /content.php Line 80

  5. Don't do that, you'll lose those edits when there is an update. Create a child theme instead and make those changes there in the child theme directory.

  6. alieneila
    Posted 3 years ago #

    Yeah... sorry child themes of Default themes is a better choice, I just haven't used default WordPress themes in years and didn't think about that =P

  7. CraigIW
    Posted 3 years ago #

    I am using a child theme. I just didn't know which file to copy :)

  8. Michael
    Forum Moderator
    Posted 3 years ago #

    consider to use a css quick-fix, by adding this to style.css in the child theme:

  9. d_random
    Posted 3 years ago #

    This worked for me:

    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');

Topic Closed

This topic has been closed to new replies.

About this Topic