Title: has_term_meta
Published: November 20, 2017
Last modified: February 24, 2026

---

# has_term_meta( int $term_id ): array|false

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#parameters)󠁿

 `$term_id`intrequired

Term ID.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#return)󠁿

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

## 󠀁[Source](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#source)󠁿

    ```php
    function has_term_meta( $term_id ) {
    	$check = wp_check_term_meta_support_prefilter( null );
    	if ( null !== $check ) {
    		return $check;
    	}

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/taxonomy.php#L1526)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/taxonomy.php#L1526-L1535)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_check_term_meta_support_prefilter()](https://developer.wordpress.org/reference/functions/wp_check_term_meta_support_prefilter/)`wp-includes/taxonomy.php` |

Aborts calls to term meta if it is not supported.

  | 
| [wpdb::get_results()](https://developer.wordpress.org/reference/classes/wpdb/get_results/)`wp-includes/class-wpdb.php` |

Retrieves an entire SQL result set from the database (i.e., many rows).

  | 
| [wpdb::prepare()](https://developer.wordpress.org/reference/classes/wpdb/prepare/)`wp-includes/class-wpdb.php` |

Prepares a SQL query for safe execution.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#)

| Used by | Description | 
| [wp_xmlrpc_server::get_term_custom_fields()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/get_term_custom_fields/)`wp-includes/class-wp-xmlrpc-server.php` |

Retrieves custom fields for a term.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/has_term_meta/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fhas_term_meta%2F)
before being able to contribute a note or feedback.