#14067 closed defect (bug) (fixed)
WP3.0 XMLRPC wp.newCategory fails for existing category
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 3.0.1 | Priority: | normal |
| Severity: | major | Version: | 3.0 |
| Component: | XML-RPC | Keywords: | xmlrpc has-patch needs-testing |
| Focuses: | Cc: |
Description (last modified by )
Hi,
I'm comparing 2.9.2 and 3.0 with the same remote client calling WP's XMLRPC, as follows:
<?php
require("class.xmlrpc.php");
$client = new IXR_Client("URL");
$client->debug = true;
$content = Array();
$content["name"] = "1-800-PetMeds";
if (!$client->query('wp.newCategory', "", "USERNAME", "PASSWORD", $content)) {
die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
} else {
$categoryID = $client->getResponse();
}
?>
On 2.9.2:
- If the category name is not in use, the category is created and the new ID returned.
- If the category name is in use, the existing ID is returned.
On 3.0:
- If the category name is not in use, the category is created and the new ID returned.
- If the category name is in use, a generic XMLRPC is returne:
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>500</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Sorry, the new category failed.</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
Attachments (1)
Change History (9)
#1
@
16 years ago
- Milestone changed from Unassigned to 3.0.1
- Severity changed from critical to major
#7
follow-up:
↓ 8
@
12 years ago
wp.newCategory returns wrong category id when the passed category is sub category.
example :
A is parent category with ID 1 and B is child/sub category with ID 2 of it
C is parent category with ID 3 and B is child/sub category with ID 4 of it
So when we pass
'name' => 'B',
'slug' => 'B',
'parent_id'=>'3'
It should return 4 but it returns 2.
#8
in reply to:
↑ 7
@
12 years ago
Replying to techaddict:
wp.newCategory returns wrong category id when the passed category is sub category.
This ticket was closed on a completed milestone. Please create a new one if there's still a problem.
Due to changes to wp_insert_term(). Patch (untested) returns the ID of the existing term when issuing a term_exists WP_Error. newCategory passes that ID along when it sees term_exists.