A_Z_Listing::get_the_item_object( string $force = '' )

Retrieve the item object for the current post


Description


Parameters

$force

(string) (Optional) Set this to 'I understand the issues!' to acknowledge that this function will cause slowness on large sites.

Default value: ''


Return

(array|null|WP_Error|WP_Post|WP_Term)


Source

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

	public function get_the_item_object( $force = '' ) {
		if ( 'I understand the issues!' === $force ) {
			$item = explode( ':', $this->current_item['item'], 1 );

			if ( isset( $item[1] ) ) {
				if ( 'terms' === $this->type ) {
					return get_term( $item[1] );
				}

				global $post;
				$post = get_post( $item[1] );
				setup_postdata( $post );

				return $post;
			}
		}

		return null;
	}

Changelog

Changelog
VersionDescription
2.0.0Introduced.

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.