WordPress at a glance

has_term_meta() WP 1.0

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

  • Global. wpdb. $wpdb WordPress database abstraction object.
✈ 1 time = 0.001984s = very slow | 50000 times = 11.92s = slow PHP 7.1.5, WP 4.9

No Hooks.

Return

Array/false. Array with meta data, or false when the meta table is not installed.

Usage

has_term_meta( $term_id );
$term_id(int) (required)
Term ID.

Code of has_term_meta: wp-includes/taxonomy.php VER 4.9.8

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

Related Functions

From tag: Metadatas (any)

No comments
    Hello, !     Log In . Register