WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 22 months ago

#10776 closed enhancement (fixed)

Function for adding 'custom taxonomy tags' when creating posts remotely using xmlrpc

Reported by: dheerg Owned by: josephscott
Milestone: 3.4 Priority: high
Severity: normal Version: 2.8.4
Component: XML-RPC Keywords:
Focuses: Cc:

Description

In a recent project I required adding custom taxonomy tags through xmlrpc, as I could not find any way to do this I added my own function to xmlrpc.php to get the job done.

I figured that as custom taxomomies have been around for a while and enhanced with 2.8 it would be neat if this could be added to the tested further and added to xmlrpc.php

I have tested it with the class-IXR.php library, and it works like a charm.

An example of its usage is:

<?php
	include '../class-IXR.php';
	$rpcurl = new IXR_Client('http://the.location.of/xmlrpc.php');
	$username = "username";
	$password = "password";
	$content['title'] = $title;
	$content['categories'] = $thecategory;
	$content['mt_keywords'] = $keywords;
	$content['mt_excerpt'] = $description;
	$content['description'] = $body;
	//Process Custom Taxanomy
	$content['mt_taxonomy'] = array(
								array( 'tags' => $thetags, 'taxonomy' => 'custom_taxonomy'),
							);
	if (!$rpcurl->query('metaWeblog.newPost','', $username, $password, $content, true)) {
		die('An error occurred - '.$rpcurl->getErrorCode().":".$rpcurl->getErrorMessage());
	}
?>

Attachments (1)

xmlrpc.patch (1.8 KB) - added by dheerg 5 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 follow-up: dd325 years ago

  • Keywords reporter-feedback added; custom taxonomy taxonomy xmlrpc taxonomy tags removed

Is there any particular reason for most of the red in that patch?

Most of it seems like its only going to cause loss of functionality

dheerg5 years ago

comment:2 in reply to: ↑ 1 dheerg5 years ago

Replying to dd32:

Is there any particular reason for most of the red in that patch?

Most of it seems like its only going to cause loss of functionality

thanks for pointing that out. made a mistake while creating/applying the patch. I have attached the correct one now.

comment:3 dd325 years ago

  • Component changed from Taxonomy to XML-RPC
  • Keywords has-patch dev-feedback added; reporter-feedback removed
  • Owner changed from filosofo to josephscott

thanks for pointing that out. made a mistake while creating/applying the patch. I have attached the correct one now.

Thought as much :)

dev-feedback for review of implementation/standards (Since i dont have a clue with XMLRPC)

comment:4 dheerg5 years ago

  • Milestone changed from 2.9 to 2.8.5

comment:5 dd325 years ago

  • Milestone changed from 2.8.5 to 2.9

All enhancements go into trunk(Next release), Only defects are backported to .x releases, And not every defect is backported either, depends on the actual issue at hand.

comment:6 dd325 years ago

  • Keywords changed from has-patch dev-feedback to has-patch, dev-feedback

comment:7 josephscott5 years ago

Why does this use a field name called mt_taxonomy? If this is a brand new field specific to WordPress then it should probably be something like wp_taxonomy.

comment:8 dheerg5 years ago

actually that's a good point. the only reason i put it as mt_taxonomy was because it was consistent with mt_keywords and mt_excerpt. But i do get your point. Would you like me to change it?

comment:9 ryan4 years ago

  • Milestone changed from 2.9 to Future Release

comment:10 nprasath0023 years ago

  • Keywords changed from has-patch, dev-feedback to has-patch dev-feedback

Related #18435

comment:11 markoheijnen22 months ago

  • Keywords has-patch dev-feedback removed
  • Milestone changed from Future Release to 3.4
  • Resolution set to fixed
  • Status changed from new to closed

This has been fixed in #18429 and #18430 for the wp methods

Last edited 22 months ago by markoheijnen (previous) (diff)
Note: See TracTickets for help on using tickets.