[wp-trac] [WordPress Trac] #62776: Non-latin post type rewrite slugs break post editor since 6.7
WordPress Trac
noreply at wordpress.org
Fri Jan 3 11:05:55 UTC 2025
#62776: Non-latin post type rewrite slugs break post editor since 6.7
--------------------------+-----------------------------
Reporter: terraling | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.7
Severity: major | Keywords:
Focuses: |
--------------------------+-----------------------------
If you register a CPT with a rewrite slug that uses non-latin characters
then when you click a back-end link to edit such a post the editor fails
to load and displays a message "You attempted to edit an item that doesn't
exist. Perhaps it was deleted?".
Does not happen in WordPress 6.6.2, happens in WordPress 6.7+
Only occurs with the Block Editor, does not occur with the Classic Editor.
The message comes from the Editor function in wp-
includes/js/dist/editor.js (the code is too opaque for me to spot what
exactly is the cause).
To reproduce, register a CPT that uses non-latin characters in the rewrite
slug (in my example I'm using Ukranian, but the same applies with
languages like Chinese or Hebrew), e.g.:
{{{#!php
<?php
function wporg_custom_post_type()
{
$recipe_labels = array(
'name' => __('Recipes', 'asif'),
'singular_name' => __('Recipe', 'asif'),
'add_new' => __('New Recipe', 'asif'),
'add_new_item' => __('Add New Recipe', 'asif'),
'edit_item' => __('Edit Recipe', 'asif'),
'new_item' => __('New Recipe', 'asif'),
'view_item' => __('View Recipe', 'asif'),
'search_items' => __('Search Recipes', 'asif'),
'not_found' => __('No Recipes Found', 'asif'),
'not_found_in_trash' => __('No Recipes found in Trash', 'asif'),
);
$recipe_args = array(
'labels' => $recipe_labels,
'public' => true,
'rewrite' => array('slug' => 'рецепт'), // non-Latin slug
'show_in_rest' => true,
);
register_post_type('recipe', $recipe_args);
}
add_action('init', 'wporg_custom_post_type');
}}}
Publish a post of that post type, go to the list of posts (e.g. Dashboard
> Recipes) then click the edit link to edit the post.
(Note, I had already created a test post before upgrading to WP 6.7; I
don't know if you can publish a post with a non-Latin rewrite slug if you
are already on WP 6.7, but if not you could temporarily use Classic
Editor.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62776>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list