I would like

I would like to disable the edit link on my pages, thank you for your time in this matter.

  • James Morris

    Hello Orlando,

    I hope you are well today. Thank you for the question.

    Disabling the edit link will depend a lot on which theme you are using. For this example, I will be using the default Twenty Sixteen theme that ships with WordPress.

    First, before we begin, it's important to note that you should never edit your primary (Parent) theme files. You should always make a Child theme and perform your modifications on it.

    You can read about How to Create a WordPress Child Theme at the following links:

    How to Create a WordPress Child Theme
    https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/

    Child Themes on WordPress Codex.
    https://codex.wordpress.org/Child_Themes

    A plugin I've used extensively to make Child Themes is Child Theme Configurator. https://wordpress.org/plugins/child-theme-configurator/

    Now, once you've created your Twenty Sixteen Child theme, you can copy over the files you want to edit into that theme's folder. For this particular theme, you'll want to copy this folder into your child theme and all of its files:

    wp-content/themes/twentysixteen/template-parts/

    Once you've copied that folder into your child theme, you'll want to look for content-single.php, content-page.php and content.php

    In those files, you'll find some code that looks like this:

    <?php
    			edit_post_link(
    				sprintf(
    					/* translators: %s: Name of current post */
    					__( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
    					get_the_title()
    				),
    				'<span class="edit-link">',
    				'</span>'
    			);
    		?>

    Simply remove that code, save, and re-upload to your Child Theme folder. That will remove the Edit link from posts and pages.

    I hope this clarifies a bit. Let us know if you have any further questions. We'll be happy to help! :slight_smile:

    Best regards,

    James Morris

  • Orlando

    Im having a difficult time doing this I did create a child them. the folder for this child is twentysixteenchild.

    do I put the folder into my childtheme or does it go into the parent theme?

    the comment section for my css is as follows:

    /*

    Theme Name: Child of Twentysixteen
    Description: Cool child theme based on Twenty Twelve
    Author: Morten Rand-Hendriksen
    Version: 0.0.1
    Template: twentysixteen
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    </body>
    </html>

    when I use this code

    <?php
    edit_post_link(
    sprintf(
    /* translators: %s: Name of current post */
    __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentysixteenchild' ),
    get_the_title()
    ),
    '<span class="edit-link">',
    '</span>'
    );
    ?>

    should it read like this?

  • James Morris

    Hello Orlando,

    I hope you are well today.

    No, I'm afraid that code won't work.

    The simplest way to create your Child Theme would be to use the Child Theme Configurator Plugin. https://wordpress.org/plugins/child-theme-configurator/

    That plugin will automate creating all the files you need for your Child Theme.

    Once you create your Child Theme, you'll need to copy the wp-content/themes/twentysixteen/template-parts/ folder into your Child Theme Folder.

    Like so:
    wp-content/themes/twentysixteen-child /template-parts/

    Once those files are in that theme, you can then edit the content-single.php, content-page.php and content.php files to remove the following code.

    <?php
    			edit_post_link(
    				sprintf(
    					/* translators: %s: Name of current post */
    					__( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
    					get_the_title()
    				),
    				'<span class="edit-link">',
    				'</span>'
    			);
    		?>

    I hope that clarifies a bit. Let us know if you have any further questions. We'll be happy to help! :slight_smile:

    Best regards,

    James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.