WordPress.org

Make WordPress Core

Ticket #21112: 21112.diff

File 21112.diff, 1007 bytes (added by coffee2code, 6 years ago)
  • wp-includes/post.php

     
    28212821 * Computes a unique slug for the post, when given the desired slug and some post details.
    28222822 *
    28232823 * @since 2.8.0
     2824 * @uses $wpdb
     2825 * @uses $wp_rewrite
     2826 * @uses apply_filters() Calls 'pre_wp_unique_post_slug' with empty string and
     2827 *  all function arguments
     2828 * @uses apply_filters() Calls 'wp_unique_post_slug' with resultant unique slug,
     2829 *  all function arguments, and the original slug
    28242830 *
    28252831 * @global wpdb $wpdb
    28262832 * @global WP_Rewrite $wp_rewrite
     
    28352841        if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    28362842                return $slug;
    28372843
     2844        $override_slug = apply_filters( 'pre_wp_unique_post_slug', '', $slug, $post_ID, $post_status, $post_type, $post_parent );
     2845        if ( $override_slug )
     2846                return $override_slug;
     2847
    28382848        global $wpdb, $wp_rewrite;
    28392849
    28402850        $original_slug = $slug;