metaWeblog.newPost no categories saved if one is not recognised
|Reported by:||Fubra||Owned by:||josephscott|
There appears to be a bug in the metaWeblog.newPost functionality of the XML-RPC which causes categories not to be assigned correctly to the new post if one or more of the supplied categories does not exist on the target blog.
For example; the blog has the category 'Cat 1', and the post is submitted with two categories 'Cat 1' and 'Cat 2'. This causes the post to be assigned to no categories at all.
This is not the expected behaviour according to the metaWeblog API RFC (http://www.xmlrpc.com/metaWeblogApi): "On the server side, it's not an error if the category doesn't exist, only record categories for ones that do exist."
A fix would be to check the return value of get_cat_ID() (around line 2216 of xmlrpc.php) and only include it in the $post_categories array if the return value is > 0.
This bug was found in 2.8.6 and exists in the currently available version of 2.9.