A_Z_Listing::get_item_meta( string $key = '', bool $single = false )

Retrieve meta field for an item.




(string) (Optional) The meta key to retrieve. By default returns data for all keys.

Default value: ''


(bool) (Optional) Whether to return a single value.

Default value: false


(mixed) Will be an array if $single is false. Will be value of meta data field if $single is true.


File: classes/class-a-z-listing.php

	function get_item_meta( $key = '', $single = false ) {
		if ( is_string( $this->current_item['item'] ) ) {
			$item = explode( ':', $this->current_item['item'], 2 );

			if ( 'term' === $type[0] ) {
				return get_term_meta( $item[1], $key, $single );

			return get_post_meta( $item[1], $key, $single );

		if ( is_a( $this->current_item['item'], 'WP_Term' ) ) {
			return get_term_meta( $this->current_item['item']->term_id, $key, $single );

		return get_post_meta( $this->current_item['item']->ID, $key, $single );


Version Description
2.1.0 Introduced.

More Information

You are currently logged out. To view tickets you must first login.

I have read and understood the Terms of Service

User Contributed Notes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.