REST API returns wrong existing category ID disregarding ParentID
-
REST API returns wrong existing category ID disregarding ParentID on new category adding.
Sample categories (PID/ID/Name):
0/2/Apple
0/3/Test$req = new WP_REST_Request( 'POST', '/wp/v2/categories' ); $req->set_param( 'parent', 3 ); $req->set_param( 'name', 'Apple' ); $r = rest_do_request( $req ); // returns $r->data['data']==2
Possible solution:
edit taxonomy.php and insert codeif ( $name_match->slug === $slug && in_array( $name, wp_list_pluck( $siblings, 'name' ) ) ) { // insert start foreach ( $name_matches as $_match ) { if ( (strtolower( $name ) === strtolower( $_match->name )) && $_match->parent==$parent) { $name_match = $_match; break; } } // insert end $existing_term = $name_match;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘REST API returns wrong existing category ID disregarding ParentID’ is closed to new replies.