WordPress.org

Ready to get started?Download WordPress

Forums

Remove edit button (9 posts)

  1. CraigIW
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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

    Thanks.

  4. alieneila
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

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

  8. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

    .post-edit-link{display:none;}
  9. d_random
    Member
    Posted 12 months 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