Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 3 years ago

#160 closed enhancement (duplicate)

While sanitize_title() returns a empty string...

Reported by: anonymousbugger's profile anonymousbugger Owned by: ryan's profile ryan
Milestone: Priority: normal
Severity: normal Version: 1.2
Component: General Keywords:
Focuses: Cc:

Description

The sanitize_title() function of WordPress 1.2 can not handle No-English characters well, especially the Asian characters such as Chinese, Japanese and Korean. If you generate a post-slug with a Chinese entry title, the post-slug will be all blank. However, WP system does not check such situation. For example, in post.php, it says:

<?php

if (empty($post_name))
$post_name = sanitize_title($post_title);
else
$post_name = sanitize_title($post_name);

The developers may not notice that after this progress, the $post_name maybe still empty. It’s an annoying problem for Non-English users to use the permalink function of WordPress. Althoght you can set the post-slug manually, you can not alter the $category_nicename of each category and $user_niceame for the authors. I think there must be more checks, for example, I added some codes to the post.php:

<?php

if (empty($post_name))
$post_name = sanitize_title($post_title);
else
$post_name = sanitize_title($post_name);

if (empty($post_name)) {
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1&Prime;);
$post_name = "post-".$post_ID + 1;
}

If the $post_name is still empty after filling the sanitized data, just fill in something somehow. I filled it with the ID of each post just because each blog entry must have an ID. I hope that the official developers may notice this problem and contain some solution to solve this problem in the very next release.

Change History (4)

#2 @ryan
19 years ago

  • Owner changed from anonymous to rboren
  • Resolution changed from 10 to 60
  • Status changed from new to closed

This ticket was mentioned in Slack in #cli by chriswiegman. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.