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. Built from https://develop.svn.wordpress.org/trunk@40916 git-svn-id: http://core.svn.wordpress.org/trunk@40766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1240,6 +1240,27 @@ function update_termmeta_cache( $term_ids ) {
|
||||
return update_meta_cache( 'term', $term_ids );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all meta data, including meta IDs, for the given term ID.
|
||||
*
|
||||
* @since 4.9.0
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @param int $term_id
|
||||
* @return array|false
|
||||
*/
|
||||
function has_term_meta( $term_id ) {
|
||||
// Bail if term meta table is not installed.
|
||||
if ( get_option( 'db_version' ) < 34370 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value, meta_id, term_id FROM $wpdb->termmeta WHERE term_id = %d ORDER BY meta_key,meta_id", $term_id ), ARRAY_A );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Term exists.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user