WordPress.org

Make WordPress Core

Ticket #36157: wp.36157.numeric-permalink.patch

File wp.36157.numeric-permalink.patch, 877 bytes (added by tha_sun, 4 years ago)
  • wp-admin/includes/post.php

    diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
    index fa3e400..d103ea9 100644
    a b function get_sample_permalink($id, $title = null, $name = null) { 
    12271227                $post->post_name = sanitize_title($name ? $name : $title, $post->ID);
    12281228
    12291229        $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
     1230        if ($post->ID === (int) $post->post_name) {
     1231                return array('', '');
     1232        }
    12301233
    12311234        $post->filter = 'sample';
    12321235
    function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 
    12891292
    12901293        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    12911294
     1295        if ($permalink === '' && $post_name === '') {
     1296                return '';
     1297        }
     1298
    12921299        $view_link = false;
    12931300        $preview_target = '';
    12941301