Make WordPress Core

Changeset 34319


Ignore:
Timestamp:
09/19/2015 05:48:30 AM (9 years ago)
Author:
wonderboymusic
Message:

When applying the 'editable_slug' filter, add a second param that provides more context.

Props MikeSchinkel, jesin.
Fixes #31568.

Location:
trunk/src/wp-admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tag-form.php

    r34202 r34319  
    122122             *
    123123             * @since 2.6.0
    124              *
    125              * @param string $slug The editable slug. Will be either a term slug or post URI depending
    126              *                     upon the context in which it is evaluated.
    127              */
    128             $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : '';
     124             * @since 4.4.0 The `$tag` parameter was added.
     125             *
     126             * @param string         $slug The editable slug. Will be either a term slug or post URI depending
     127             *                             upon the context in which it is evaluated.
     128             * @param object|WP_Post $tag  Term or WP_Post object.
     129             */
     130            $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
    129131            ?>
    130132            <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r34265 r34319  
    374374
    375375        /** This filter is documented in wp-admin/edit-tag-form.php */
    376         $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>';
     376        $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
    377377        $out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
    378378
     
    472472    public function column_slug( $tag ) {
    473473        /** This filter is documented in wp-admin/edit-tag-form.php */
    474         return apply_filters( 'editable_slug', $tag->slug );
     474        return apply_filters( 'editable_slug', $tag->slug, $tag );
    475475    }
    476476
  • trunk/src/wp-admin/includes/meta-boxes.php

    r34170 r34319  
    695695function post_slug_meta_box($post) {
    696696/** This filter is documented in wp-admin/edit-tag-form.php */
    697 ?>
    698 <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 ) ); ?>" />
     697$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
     698?>
     699<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( $editable_slug ); ?>" />
    699700<?php
    700701}
  • trunk/src/wp-admin/includes/post.php

    r34309 r34319  
    12441244
    12451245        /** This filter is documented in wp-admin/edit-tag-form.php */
    1246         $uri = apply_filters( 'editable_slug', $uri );
     1246        $uri = apply_filters( 'editable_slug', $uri, $post );
    12471247        if ( !empty($uri) )
    12481248            $uri .= '/';
     
    12511251
    12521252    /** This filter is documented in wp-admin/edit-tag-form.php */
    1253     $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name ) );
     1253    $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) );
    12541254    $post->post_status = $original_status;
    12551255    $post->post_date = $original_date;
  • trunk/src/wp-admin/includes/template-functions.php

    r34241 r34319  
    274274    echo '
    275275<div class="hidden" id="inline_' . $post->ID . '">
    276     <div class="post_title">' . $title . '</div>
    277     <div class="post_name">' . apply_filters( 'editable_slug', $post->post_name ) . '</div>
     276    <div class="post_title">' . $title . '</div>' .
     277    /** This filter is documented in wp-admin/edit-tag-form.php */
     278    '<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
    278279    <div class="post_author">' . $post->post_author . '</div>
    279280    <div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
Note: See TracChangeset for help on using the changeset viewer.