#14067 closed defect (bug) (fixed)
WP3.0 XMLRPC wp.newCategory fails for existing category
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0.1 |
| Component: | XML-RPC | Version: | 3.0 |
| Severity: | major | Keywords: | xmlrpc has-patch needs-testing |
| Cc: |
Description (last modified by ryan)
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 (7)
- Milestone changed from Unassigned to 3.0.1
- Severity changed from critical to major
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

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.