WordPress.org

Ready to get started?Download WordPress

Forums

No two Chinese posts can have same title on local MAMP install (5 posts)

  1. michaelangela
    Member
    Posted 6 years ago #

    Just looking to see if anyone else is having this trouble. I have search the forums but have not found anything similar.

    Everything runs fine unless I add an empty post with title:

    中文

    and then add another post of the same title. The server times out. My database is MySQL 5, server is Apache2 running PHP5, no other problems. Other than that issue the wordpress install works fine. I also tested with

    define('DB_COLLATE', 'utf8_general_ci');

    in the wp-config.php to make sure it's the right one. Still testing.

    Of course it works fine on the wordpress site itself, so it's something wrong with my local setup. Any thoughts? I am guessing it has something to do with the slug creation on my box but not sure. Multiple English posts work fine of course, and the slugs are correctly generated. I am still looking into that.

    Thanks in advance,

    Michael

  2. michaelangela
    Member
    Posted 6 years ago #

    Just confirmed that it has to do something with the slug.

    I am using the python wordpresslib to do some tests over xml-rpc, and I changed it to add support for the slug. Doing posts with the same name but different slugs in Chinese works. In this case it is

    In [21]: post.title = '中文'
    In [22]: idPost = wp.newPost(post,True)
    - no problem
    In [23]: post.slug = '中文-2'
    In [24]: idPost = wp.newPost(post,True)
    - title is the same, but I added the slug and it's no problem

    In [25]: idPost = wp.newPost(post,True)
    - title and/or slug is the same the server hangs again

    So, in the meantime, I'll just have to be careful about post names.

  3. michaelangela
    Member
    Posted 6 years ago #

    Hmm. I also have hit or miss success with Chinese tags as well. My local setup must have something just... off...

  4. michaelangela
    Member
    Posted 6 years ago #

    But I mean, within admin, clicking on a Chinese tag might show the correct results, and if it does, that tag is fine. However, other tags don't show results when you click on them. Searching for text still works correctly though. When the tag doesn't work, it says

    Manage Posts tagged with “”

    So it's just not getting through somehow. Odd.

  5. wandererm
    Member
    Posted 6 years ago #

    someone give me a solution:

    at wp-includes\post.php line 1289:

    $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != %d AND post_parent = %d LIMIT 1", $post_ID, $post_parent));

    change to

    $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != $post_ID AND post_parent = $post_parent LIMIT 1");

    But I don't know why this works.

Topic Closed

This topic has been closed to new replies.

About this Topic