Support » Developing with WordPress » Unicode Characters in page slug leads to a 404 error on a Network of sites

  • Resolved mike40033



    I have a network of sites, one site for each language I’m gettinf the site translated into.

    Some of the sites have problems, I think it’s because of Unicode characters in page slugs. Oddly, pages without special characters in the URl also have the same problem.

    The site with the problem is at

    You can find pages using the search box, and there’s a page listed in the menu – however, clicking any link to a page produces a 404 error.

    NB the pages were not created via the wordpress interface, but via a script, trying to grab the content that had been auto-translated by the GTS translation plugin.

    $result = mysql_query("SET NAMES utf8");
    $sql = "delete from wp_5_posts where 1";
    $res = mysql_query($sql);
    $sql = "select * from wp_gts_translated_posts where language='pl'";
    $res = mysql_query($sql);
    while ($row = mysql_fetch_assoc($res)) {
      $insert = "insert into wp_5_posts ";
      $fields = "(post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_name, post_modified, post_modified_gmt, menu_order, post_type, comment_count)";
      $val = " values ";
      $values = "(1, '" . $row['created_time'] . "', '" . $row['created_time'] . "', '" . addslashes($row['post_body']) . "', '" . addslashes($row['post_title']) . "', '" . $row['post_excerpt'] . "', 'publish', 'open', 'open', '" . addslashes($row['post_slug']) . "', '" . $row['modified_time'] . "', '" . $row['modified_time'] . "', 0, 'page', 0)";
      $sql = $insert . $fields . $val . $values;
    //  print($fields . "\n");
      print('moving ' . $row['post_title'] . ".....\n");
      $result = mysql_query($sql);

    This script worked fine for French, Spanish, Italian, German… but not Polish… See , for example.

    I’ve tried the advice at to no avail….

    Help! Is there anything else left for me to try?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Based on my previous experiences I would suggest a quick workaround.
    1) login to your mysql DB and change the table collation to utf8_general_ci
    2) update the permalink thereafter should do the trick.
    HTH !!

    If the Codex isn’t helping, login to your WP admin panel > Settings > Permalinks > Choose the desired structure and click ‘Save Changes’.

    This will properly rewrite your .htaccess file.

    Hi all, thanks for your replies…

    The solution I found that worked was simply to urlencode() the post slugs before putting them into the database.

    They appear as legible characters in the WordPress post slug field, and in modern browser URL boxes, but under the covers they’re all urlencoded now.

    Unless it was this PLUS some earlier tinkering I thought had not worked.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unicode Characters in page slug leads to a 404 error on a Network of sites’ is closed to new replies.