Make WordPress Core

Ticket #31568: 31568.2.diff

File 31568.2.diff, 4.4 KB (added by jesin, 10 years ago)
  • src/wp-admin/includes/meta-boxes.php

     
    661661function post_slug_meta_box($post) {
    662662/** This filter is documented in wp-admin/edit-tag-form.php */
    663663?>
    664 <label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $post->post_name ) ); ?>" />
     664<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $post->post_name, $post ) ); ?>" />
    665665<?php
    666666}
    667667
  • src/wp-admin/includes/post.php

     
    12271227                }
    12281228
    12291229                /** This filter is documented in wp-admin/edit-tag-form.php */
    1230                 $uri = apply_filters( 'editable_slug', $uri );
     1230                $uri = apply_filters( 'editable_slug', $uri, $post );
    12311231                if ( !empty($uri) )
    12321232                        $uri .= '/';
    12331233                $permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
    12341234        }
    12351235
    12361236        /** This filter is documented in wp-admin/edit-tag-form.php */
    1237         $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name ) );
     1237        $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) );
    12381238        $post->post_status = $original_status;
    12391239        $post->post_date = $original_date;
    12401240        $post->post_name = $original_name;
  • src/wp-admin/includes/template.php

     
    359359        echo '
    360360<div class="hidden" id="inline_' . $post->ID . '">
    361361        <div class="post_title">' . $title . '</div>
    362         <div class="post_name">' . apply_filters( 'editable_slug', $post->post_name ) . '</div>
     362        <div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
    363363        <div class="post_author">' . $post->post_author . '</div>
    364364        <div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
    365365        <div class="ping_status">' . esc_html( $post->ping_status ) . '</div>
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    368368                $out .= '<div class="name">' . $qe_data->name . '</div>';
    369369
    370370                /** This filter is documented in wp-admin/edit-tag-form.php */
    371                 $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>';
     371                $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
    372372                $out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
    373373
    374374                return $out;
     
    388388         */
    389389        public function column_slug( $tag ) {
    390390                /** This filter is documented in wp-admin/edit-tag-form.php */
    391                 return apply_filters( 'editable_slug', $tag->slug );
     391                return apply_filters( 'editable_slug', $tag->slug, $tag );
    392392        }
    393393
    394394        /**
  • src/wp-admin/edit-tag-form.php

     
    9797                         * post URIs and term slugs.
    9898                         *
    9999                         * @since 2.6.0
     100                         * @since 4.2.0 The `$tag` parameter was added.
    100101                         *
    101102                         * @param string $slug The editable slug. Will be either a term slug or post URI depending
    102103                         *                     upon the context in which it is evaluated.
     104                         * @param object|WP_Post $tag Term or WP_Post object.
    103105                         */
    104                         $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : '';
     106                        $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
    105107                        ?>
    106108                        <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
    107109                        <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>