[wp-trac] [WordPress Trac] #46297: Unable to edit specific terms : rest_cannot_assign_term OR 403
WordPress Trac
noreply at wordpress.org
Mon Mar 7 22:13:42 UTC 2022
#46297: Unable to edit specific terms : rest_cannot_assign_term OR 403
--------------------------+----------------------------------
Reporter: enps5 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.1
Severity: major | Resolution:
Keywords: | Focuses: multisite, rest-api
--------------------------+----------------------------------
Description changed by SergeyBiryukov:
Old description:
> This bug seems to be related to this changeset :
> https://core.trac.wordpress.org/changeset/30056
>
> When i try create a new post with gutenberg and categorize the post
> taxonomy "bibliografía" i've this error :
>
> {{{
> Updating failed
> }}}
>
> The request body is :
>
> {{{
> {"status":"draft","title":"test","excerpt":"","categories":[4092],"content":"<!--
> wp:paragraph -->\n<p>test</p>\n<!-- /wp:paragraph -->","id":1552}
> }}}
>
> Response from wordpress :
>
> {{{
> {"code":"rest_cannot_assign_term","message":"Sorry, you are not allowed
> to assign the provided terms.","data":{"status":403}}
> }}}
>
> On a WordPress network, when i attempt to edit the category as a
> wordpress super-user (this time i use the term.php's file) :
> https://DOMAIN.TLD/wp-
> admin/term.php?taxonomy=category&tag_ID=4092&post_type=post&wp_http_referer
> =%2Fwp-admin%2Fedit-
> tags.php%3Ftaxonomy%3Dcategory%26post_type%3Dpost%26s%3Dbibliograf%25C3%25ADa
> Wordpress return :
>
> {{{
> You need a higher level of permission.
>
> Sorry, you are not allowed to edit this item.
> }}}
>
> A further look inside MySQL shows :
>
> {{{
> SELECT * FROM wp_2635_terms where term_id = 4092 ;
> +---------+---------------+--------------+------------+
> | term_id | name | slug | term_group |
> +---------+---------------+--------------+------------+
> | 4092 | bibliografía | bibliografia | 0 |
> +---------+---------------+--------------+------------+
>
> SELECT * FROM wp_2635_term_taxonomy where term_id = 4092 ;
> +------------------+---------+----------+-------------+--------+-------+
> | term_taxonomy_id | term_id | taxonomy | description | parent | count |
> +------------------+---------+----------+-------------+--------+-------+
> | 254 | 4092 | category | | 0 | 1 |
> | 197 | 4092 | post_tag | | 0 | 1 |
> +------------------+---------+----------+-------------+--------+-------+
>
> SELECT * FROM wp_2635_term_taxonomy GROUP BY term_id HAVING
> COUNT(term_id) > 1;
> +------------------+---------+----------+-------------+--------+-------+
> | term_taxonomy_id | term_id | taxonomy | description | parent | count |
> +------------------+---------+----------+-------------+--------+-------+
> | 254 | 4092 | category | | 0 | 1 |
> | 205 | 4191 | category | | 0 | 7 |
> | 357 | 52788 | category | | 0 | 1 |
> | 196 | 57611 | category | | 0 | 4 |
> | 354 | 226144 | category | | 0 | 6 |
> | 355 | 955714 | category | | 0 | 2 |
> | 298 | 1595453 | category | | 0 | 2 |
> | 313 | 1595513 | category | | 0 | 8 |
> | 177 | 1595576 | category | | 0 | 12 |
> | 379 | 1939409 | category | | 0 | 6 |
> | 329 | 1939420 | category | | 0 | 4 |
> | 312 | 1939471 | category | | 0 | 2 |
> | 314 | 1939479 | category | | 0 | 4 |
> | 359 | 2399420 | category | | 0 | 1 |
> | 438 | 2454276 | category | | 0 | 1 |
> +------------------+---------+----------+-------------+--------+-------+
> 15 rows in set (0.00 sec)
>
> select term_id,slug,COUNT(slug) from wp_2635_terms group by slug having
> count(slug) > 1;
> +---------+------------------------------+-------------+
> | term_id | slug | COUNT(slug) |
> +---------+------------------------------+-------------+
> | 4191 | antropologia | 4 |
> | 1595576 | antropologia-linguistica | 2 |
> | 1595401 | audios | 3 |
> | 4092 | bibliografia | 2 |
> | 809963 | canal-uned | 3 |
> | 52788 | cervantes | 2 |
> | 2454276 | coelei | 2 |
> | 1595453 | curso-de-verano | 2 |
> | 1939479 | edicion-de-textos | 2 |
> | 1595578 | etnografia-del-habla | 3 |
> | 1595478 | etnolinguistica | 3 |
> | 1939420 | eugenio-de-salazar | 2 |
> | 1939409 | glosonimia | 2 |
> | 465167 | jornadas | 3 |
> | 1595513 | lexicografia | 2 |
> | 1595414 | metodologia-docente | 3 |
> | 1595416 | nuevas-propuestas-didacticas | 3 |
> | 1595417 | paper-li | 3 |
> | 200504 | proyectos | 3 |
> | 57611 | publicaciones | 2 |
> | 2399420 | tecnolecto-marinero | 2 |
> | 226144 | uned | 2 |
> | 1939471 | universidad-del-pacifico | 2 |
> | 955714 | vocabulario | 2 |
> +---------+------------------------------+-------------+
>
> desc wp_2635_terms ;
> +------------+---------------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra
> |
> +------------+---------------------+------+-----+---------+----------------+
> | term_id | bigint(20) unsigned | NO | PRI | NULL |
> auto_increment |
> | name | varchar(200) | NO | MUL | |
> |
> | slug | varchar(200) | NO | MUL | |
> |
> | term_group | bigint(10) | NO | | 0 |
> |
> +------------+---------------------+------+-----+---------+----------------+
> 4 rows in set (0.01 sec)
>
> desc wp_2635_term_taxonomy ;
> +------------------+---------------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra
> |
> +------------------+---------------------+------+-----+---------+----------------+
> | term_taxonomy_id | bigint(20) unsigned | NO | PRI | NULL |
> auto_increment |
> | term_id | bigint(20) unsigned | NO | MUL | 0 |
> |
> | taxonomy | varchar(32) | NO | MUL | |
> |
> | description | longtext | NO | | NULL |
> |
> | parent | bigint(20) unsigned | NO | | 0 |
> |
> | count | bigint(20) | NO | | 0 |
> |
> +------------------+---------------------+------+-----+---------+----------------+
>
> show create table wp_2635_terms \G
> *************************** 1. row ***************************
> Table: wp_2635_terms
> Create Table: CREATE TABLE `wp_2635_terms` (
> `term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
> `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
> `slug` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
> `term_group` bigint(10) NOT NULL DEFAULT '0',
> PRIMARY KEY (`term_id`),
> KEY `slug` (`slug`(191)),
> KEY `name` (`name`(191))
> ) ENGINE=InnoDB AUTO_INCREMENT=2454306 DEFAULT CHARSET=utf8mb4
> COLLATE=utf8mb4_unicode_ci
> 1 row in set (0.00 sec)
>
> show create table wp_2635_term_taxonomy \G
> *************************** 1. row ***************************
> Table: wp_2635_term_taxonomy
> Create Table: CREATE TABLE `wp_2635_term_taxonomy` (
> `term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
> `term_id` bigint(20) unsigned NOT NULL DEFAULT '0',
> `taxonomy` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
> `description` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
> `parent` bigint(20) unsigned NOT NULL DEFAULT '0',
> `count` bigint(20) NOT NULL DEFAULT '0',
> PRIMARY KEY (`term_taxonomy_id`),
> UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`),
> KEY `taxonomy` (`taxonomy`)
> ) ENGINE=InnoDB AUTO_INCREMENT=462 DEFAULT CHARSET=utf8mb4
> COLLATE=utf8mb4_unicode_ci
> 1 row in set (0.00 sec)
>
> }}}
>
> If i delete (via MySQL delete statement) the post_tag with the term_id
> 4092, i can edit again the category. I had trouble reproducing the bug or
> to simply to identify the cause of the problem.
>
> We're running a WordPress Network with ~5000blogs, i've identified this
> problem on 1300 sites.
> We work with MySQL "classic replication" (master / slave), we already had
> a master x3 configuration with Galera Cluster. This can be an interesting
> element.
>
> I remain available for aby further information.
New description:
This bug seems to be related to this changeset : [30056]
When i try create a new post with gutenberg and categorize the post
taxonomy "bibliografía" i've this error :
{{{
Updating failed
}}}
The request body is :
{{{
{"status":"draft","title":"test","excerpt":"","categories":[4092],"content":"<!--
wp:paragraph -->\n<p>test</p>\n<!-- /wp:paragraph -->","id":1552}
}}}
Response from wordpress :
{{{
{"code":"rest_cannot_assign_term","message":"Sorry, you are not allowed to
assign the provided terms.","data":{"status":403}}
}}}
On a WordPress network, when i attempt to edit the category as a wordpress
super-user (this time i use the term.php's file) :
https://DOMAIN.TLD/wp-
admin/term.php?taxonomy=category&tag_ID=4092&post_type=post&wp_http_referer
=%2Fwp-admin%2Fedit-
tags.php%3Ftaxonomy%3Dcategory%26post_type%3Dpost%26s%3Dbibliograf%25C3%25ADa
Wordpress return :
{{{
You need a higher level of permission.
Sorry, you are not allowed to edit this item.
}}}
A further look inside MySQL shows :
{{{
SELECT * FROM wp_2635_terms where term_id = 4092 ;
+---------+---------------+--------------+------------+
| term_id | name | slug | term_group |
+---------+---------------+--------------+------------+
| 4092 | bibliografía | bibliografia | 0 |
+---------+---------------+--------------+------------+
SELECT * FROM wp_2635_term_taxonomy where term_id = 4092 ;
+------------------+---------+----------+-------------+--------+-------+
| term_taxonomy_id | term_id | taxonomy | description | parent | count |
+------------------+---------+----------+-------------+--------+-------+
| 254 | 4092 | category | | 0 | 1 |
| 197 | 4092 | post_tag | | 0 | 1 |
+------------------+---------+----------+-------------+--------+-------+
SELECT * FROM wp_2635_term_taxonomy GROUP BY term_id HAVING COUNT(term_id)
> 1;
+------------------+---------+----------+-------------+--------+-------+
| term_taxonomy_id | term_id | taxonomy | description | parent | count |
+------------------+---------+----------+-------------+--------+-------+
| 254 | 4092 | category | | 0 | 1 |
| 205 | 4191 | category | | 0 | 7 |
| 357 | 52788 | category | | 0 | 1 |
| 196 | 57611 | category | | 0 | 4 |
| 354 | 226144 | category | | 0 | 6 |
| 355 | 955714 | category | | 0 | 2 |
| 298 | 1595453 | category | | 0 | 2 |
| 313 | 1595513 | category | | 0 | 8 |
| 177 | 1595576 | category | | 0 | 12 |
| 379 | 1939409 | category | | 0 | 6 |
| 329 | 1939420 | category | | 0 | 4 |
| 312 | 1939471 | category | | 0 | 2 |
| 314 | 1939479 | category | | 0 | 4 |
| 359 | 2399420 | category | | 0 | 1 |
| 438 | 2454276 | category | | 0 | 1 |
+------------------+---------+----------+-------------+--------+-------+
15 rows in set (0.00 sec)
select term_id,slug,COUNT(slug) from wp_2635_terms group by slug having
count(slug) > 1;
+---------+------------------------------+-------------+
| term_id | slug | COUNT(slug) |
+---------+------------------------------+-------------+
| 4191 | antropologia | 4 |
| 1595576 | antropologia-linguistica | 2 |
| 1595401 | audios | 3 |
| 4092 | bibliografia | 2 |
| 809963 | canal-uned | 3 |
| 52788 | cervantes | 2 |
| 2454276 | coelei | 2 |
| 1595453 | curso-de-verano | 2 |
| 1939479 | edicion-de-textos | 2 |
| 1595578 | etnografia-del-habla | 3 |
| 1595478 | etnolinguistica | 3 |
| 1939420 | eugenio-de-salazar | 2 |
| 1939409 | glosonimia | 2 |
| 465167 | jornadas | 3 |
| 1595513 | lexicografia | 2 |
| 1595414 | metodologia-docente | 3 |
| 1595416 | nuevas-propuestas-didacticas | 3 |
| 1595417 | paper-li | 3 |
| 200504 | proyectos | 3 |
| 57611 | publicaciones | 2 |
| 2399420 | tecnolecto-marinero | 2 |
| 226144 | uned | 2 |
| 1939471 | universidad-del-pacifico | 2 |
| 955714 | vocabulario | 2 |
+---------+------------------------------+-------------+
desc wp_2635_terms ;
+------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra
|
+------------+---------------------+------+-----+---------+----------------+
| term_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment
|
| name | varchar(200) | NO | MUL | |
|
| slug | varchar(200) | NO | MUL | |
|
| term_group | bigint(10) | NO | | 0 |
|
+------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.01 sec)
desc wp_2635_term_taxonomy ;
+------------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra
|
+------------------+---------------------+------+-----+---------+----------------+
| term_taxonomy_id | bigint(20) unsigned | NO | PRI | NULL |
auto_increment |
| term_id | bigint(20) unsigned | NO | MUL | 0 |
|
| taxonomy | varchar(32) | NO | MUL | |
|
| description | longtext | NO | | NULL |
|
| parent | bigint(20) unsigned | NO | | 0 |
|
| count | bigint(20) | NO | | 0 |
|
+------------------+---------------------+------+-----+---------+----------------+
show create table wp_2635_terms \G
*************************** 1. row ***************************
Table: wp_2635_terms
Create Table: CREATE TABLE `wp_2635_terms` (
`term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`slug` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`term_group` bigint(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`term_id`),
KEY `slug` (`slug`(191)),
KEY `name` (`name`(191))
) ENGINE=InnoDB AUTO_INCREMENT=2454306 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)
show create table wp_2635_term_taxonomy \G
*************************** 1. row ***************************
Table: wp_2635_term_taxonomy
Create Table: CREATE TABLE `wp_2635_term_taxonomy` (
`term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`term_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`taxonomy` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`description` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`parent` bigint(20) unsigned NOT NULL DEFAULT '0',
`count` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`term_taxonomy_id`),
UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`),
KEY `taxonomy` (`taxonomy`)
) ENGINE=InnoDB AUTO_INCREMENT=462 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)
}}}
If i delete (via MySQL delete statement) the post_tag with the term_id
4092, i can edit again the category. I had trouble reproducing the bug or
to simply to identify the cause of the problem.
We're running a WordPress Network with ~5000blogs, i've identified this
problem on 1300 sites.
We work with MySQL "classic replication" (master / slave), we already had
a master x3 configuration with Galera Cluster. This can be an interesting
element.
I remain available for aby further information.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46297#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list