WordPress.org

Make WordPress Core

Ticket #10760: no-change-permalinks-if-is-front.diff

File no-change-permalinks-if-is-front.diff, 1.0 KB (added by simonwheatley, 6 years ago)

Adds a check to see whether the page being edited is the front page before showing the "Change Permalinks" link

  • Users/simon/Projects/SKAI/site/wordpress/wp-admin/includes/post.php

     
    977977 
    978978        if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { 
    979979                $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; 
    980                 if ( current_user_can( 'manage_options' ) ) 
     980                $is_front_page = (bool) ( $post->ID == get_option( 'page_on_front' ) ); 
     981                if ( current_user_can( 'manage_options' ) && ! $is_front_page ) 
    981982                        $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; 
    982983                if ( isset($view_post) ) 
    983984                        $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n";