Make WordPress Core

Ticket #18523: 18523.4.diff

File 18523.4.diff, 3.2 KB (added by helen, 8 years ago)

Patch in progress for safekeeping

  • src/wp-admin/edit-form-advanced.php

     
    304304        }
    305305}
    306306
    307 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
    308         add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
    309 
    310307if ( post_type_supports($post_type, 'author') ) {
    311308        if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
    312309                add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
     
    567564?>
    568565<div class="inside">
    569566<?php
    570 if ( $viewable ) :
    571 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
     567if ( $viewable ) {
     568        $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
    572569
    573 // As of 4.4, the Get Shortlink button is hidden by default.
    574 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
    575         $shortlink = wp_get_shortlink($post->ID, 'post');
     570        // As of 4.4, the Get Shortlink button is hidden by default.
     571        if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
     572                $shortlink = wp_get_shortlink($post->ID, 'post');
    576573
    577         if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) {
    578         $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
     574                if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) {
     575                $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
     576                }
    579577        }
    580 }
    581578
    582 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
    583         $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
    584 ?>
    585         <div id="edit-slug-box" class="hide-if-no-js">
     579        if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
     580                $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
     581        ?>
     582                <div id="edit-slug-box" class="hide-if-no-js">
     583                <?php
     584                        if ( $has_sample_permalink )
     585                                echo $sample_permalink_html;
     586                ?>
     587                </div>
    586588        <?php
    587                 if ( $has_sample_permalink )
    588                         echo $sample_permalink_html;
     589        }
     590} elseif( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
     591        $editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
    589592        ?>
    590         </div>
    591 <?php
     593        <label for="post_name"><?php _e( 'Slug:' ) ?></label>
     594        <input name="post_name" type="text" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
     595        <?php
    592596}
    593 endif;
    594597?>
    595598</div>
    596599<?php