A WordPress-centric search engine for devs and theme authors



has_term_meta ›

Since4.9.0
Deprecatedn/a
has_term_meta ( $term_id )
Parameters:
  • (int) $term_id Term ID.
    Required: Yes
Returns:
  • (array|false) Array with meta data, or false when the meta table is not installed.
Defined at:
Codex:

Get all meta data, including meta IDs, for the given term ID.



Source

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 );
}