WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#35991 closed enhancement (fixed)

Adding support of terms meta to XML-RPC

Reported by: enrico.sorcinelli Owned by: boonebgorges
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.4
Component: XML-RPC Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Since I'd need to do a batch custom taxonomy import (with additional meta terms) via XML-RPC, unfortunately I noticed that it seems that the XML-RPC doesn't allow to handle terms meta as introduced in 4.4.

This patch aims to add the support of terms meta to XML-RPC, specifically for wp.addTerm, wp.getTerms, wp.editTerm and wp.editTerms methods, in same way the API does with post custom fields.

The patch is a starting point and probably has to be revised since it assumes the fine-grained caps for taxonomy terms (see 35614).

Also, the patch add the new has_term_meta() function to taxonomy.php in order to return also meta term IDs that could be needed in subsequent XMP-RPC wp.editTerm calls.

Attachments (6)

35991.patch (3.8 KB) - added by enrico.sorcinelli 5 years ago.
35991_with_unit_tests.patch (6.8 KB) - added by enrico.sorcinelli 5 years ago.
This patch containing also the unit tests replaces the previous one.
35991.2.patch (7.0 KB) - added by enrico.sorcinelli 5 years ago.
Updated tests and updated check of caps. This patch replaces the previous ones
35991.3.patch (7.0 KB) - added by enrico.sorcinelli 5 years ago.
Updated to trunk. This patch replaces the previous ones
35991.4.patch (7.3 KB) - added by enrico.sorcinelli 4 years ago.
Updated to trunk. This patch replaces the previous ones
35991.5.patch (7.3 KB) - added by enrico.sorcinelli 4 years ago.
Updated to trunk. This patch replaces the previous ones

Download all attachments as: .zip

Change History (20)

#1 @enrico.sorcinelli
5 years ago

  • Keywords has-patch added

#2 follow-up: @dd32
5 years ago

  • Keywords needs-unit-tests added

This will require unit tests if it's to be considered.

@enrico.sorcinelli
5 years ago

This patch containing also the unit tests replaces the previous one.

#3 in reply to: ↑ 2 @enrico.sorcinelli
5 years ago

I just submitted an updated patch with unit tests.

Until the fine-grain taxnomony term will be developed/added to the core (see 35614), all the current_user_can() statements in the patch (relative to class-wp-xmlrpc-server.php) are for demonstration purpose only and they can be replaced with current_user_can( 'manage_categories' )

PS: I misspelled the related XML-RPC methods in the initial post, the correct ones are of course: wp.newTerm, wp.getTerm, wp.editTerm, wp.getTerms :-)

@enrico.sorcinelli
5 years ago

Updated tests and updated check of caps. This patch replaces the previous ones

#4 @boonebgorges
5 years ago

  • Keywords has-unit-tests 4.6-early added; needs-unit-tests removed
  • Milestone changed from Awaiting Review to Future Release

Thanks for the patch, @enrico.sorcinelli. Let's look at this for 4.6.

#5 @chriscct7
5 years ago

  • Version trunk deleted

@enrico.sorcinelli
5 years ago

Updated to trunk. This patch replaces the previous ones

#6 @enrico.sorcinelli
5 years ago

  • Version set to trunk

#7 @rachelbaker
5 years ago

  • Version trunk deleted

#8 @boonebgorges
5 years ago

  • Keywords 4.7-early added; 4.6-early removed

Missed this for 4.6. Let's look next time around.

This ticket was mentioned in Slack in #core by helen. View the logs.


4 years ago

@enrico.sorcinelli
4 years ago

Updated to trunk. This patch replaces the previous ones

#10 @enrico.sorcinelli
4 years ago

I just updated again the patch to the current trunk by updating tests and checks of caps (using edit/add/delete_term_meta introduced in 4.7).

This patch replaces the previous ones.

@enrico.sorcinelli
4 years ago

Updated to trunk. This patch replaces the previous ones

#11 @enrico.sorcinelli
4 years ago

I just updated again the patch to the current trunk.

#12 @boonebgorges
4 years ago

  • Keywords 4.7-early removed
  • Milestone changed from Future Release to 4.9
  • Owner set to boonebgorges
  • Status changed from new to assigned

Thank you for the updated patch, @enrico.sorcinelli.

I'd like a few more unit tests to cover the editTerm endpoint, which I will add myself. I'll also clean up the formatting.

#13 @boonebgorges
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 40916:

Add term meta support to XML-RPC addTerm and editTerm endpoints.

This changeset also includes the new function has_term_meta(), a
counterpart to has_meta() (for posts).

Props enrico.sorcinelli.
Fixes #35991.

#14 @johnbillion
3 years ago

  • Version set to 4.4
Note: See TracTickets for help on using tickets.