• Hi,

    I recently found an issue that apparently causes some sort of name conflict between permalinks with similar slugs. For instance, if I have two distinct custom permalinks ‘new-york’ and ‘new-york-city’ the first one will work as expected but the second one will redirect me to an unrelated post. As far as I could find, the source of the problem seems to be happening during the permalink matching on the custom_permalink_table, on the ‘custom_permalinks_request($query)’ function:

    $permalink == substr($request_noslash, 0, strlen($permalink)

    Replacing it with an exact string match seems to solve my problem.

    I was wondering if this was an intended behaviour and if so, what’s the reason why it is not using an exact string match to find the correct permalink.

    Thanks,

    https://ww.wp.xz.cn/plugins/custom-permalinks/

Viewing 1 replies (of 1 total)
  • I have same problem.

    1) I have page “/testpage” with Title “Testpage”;
    > First page returns 200 OK
    2) If I create page /test with title “New test Page” and custom-permalink “test”
    > First page returns 404.
    3) Than I add custom_permalink to first page with value “testpage”
    > First page returns 200 OK
    4) Than if I update first page, custom_permalink == post_title and will be removed
    > First page returns 404.

    mysql> SELECT wp_posts.ID, wp_postmeta.meta_value, wp_posts.post_type FROM wp_posts LEFT JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE meta_key = ‘custom_permalink’ AND meta_value != ” AND ( LOWER(meta_value) = LEFT(LOWER(‘contao’), LENGTH(meta_value)));

    I think, reason of this issue in this code – ( LOWER(meta_value) = LEFT(LOWER(‘%s’), LENGTH(meta_value))

    https://github.com/wp-plugins/custom-permalinks/commit/f559d18a604212b61927af2dec9789fd48692637
    12 Nov 2008

    @michaeltyson, what do you think about this issue?

Viewing 1 replies (of 1 total)

The topic ‘Custom permalinks slug conflicts’ is closed to new replies.