Make WordPress Core


Ignore:
Timestamp:
06/18/2017 10:39:12 AM (7 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r40513 r40916  
    12421242
    12431243/**
     1244 * Get all meta data, including meta IDs, for the given term ID.
     1245 *
     1246 * @since 4.9.0
     1247 *
     1248 * @global wpdb $wpdb WordPress database abstraction object.
     1249 *
     1250 * @param int $term_id
     1251 * @return array|false
     1252 */
     1253function has_term_meta( $term_id ) {
     1254    // Bail if term meta table is not installed.
     1255    if ( get_option( 'db_version' ) < 34370 ) {
     1256        return false;
     1257    }
     1258
     1259    global $wpdb;
     1260
     1261    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 );
     1262}
     1263
     1264/**
    12441265 * Check if Term exists.
    12451266 *
Note: See TracChangeset for help on using the changeset viewer.