WordPress.org

Make WordPress Core

Ticket #6915: editable-slug-filter.diff

File editable-slug-filter.diff, 3.0 KB (added by nbachiyski, 6 years ago)

Patch, which allows to manipulate the slug, which the user can edit

  • wp-admin/includes/post.php

     
    627627                $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink); 
    628628        } 
    629629 
    630         $permalink = array($permalink, $post->post_name); 
     630        $permalink = array($permalink, apply_filters('editable_slug', $post->post_name)); 
    631631        $post->post_status = $original_status; 
    632632        $post->post_date = $original_date; 
    633633        $post->post_name = $original_name; 
  • wp-admin/edit-link-category-form.php

     
    3030                </tr> 
    3131                <tr class="form-field"> 
    3232                        <th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th> 
    33                         <td><input name="slug" id="slug" type="text" value="<?php echo $category->slug; ?>" size="40" /> 
     33                        <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /> 
    3434            <?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.'); ?></td> 
    3535                </tr> 
    3636                <tr class="form-field"> 
  • wp-admin/edit-tag-form.php

     
    3131                </tr> 
    3232                <tr class="form-field"> 
    3333                        <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th> 
    34                         <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($tag->slug); ?>" size="40" /> 
     34                        <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" /> 
    3535            <p><?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> 
    3636                </tr> 
    3737        </table> 
  • wp-admin/edit-category-form.php

     
    3131                </tr> 
    3232                <tr class="form-field"> 
    3333                        <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th> 
    34                         <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->slug); ?>" size="40" /><br /> 
     34                        <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br /> 
    3535            <?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.'); ?></td> 
    3636                </tr> 
    3737                <tr class="form-field">