Astra_Header_Search_Component_Configs::get_search_post_types_choices()

Get formatted live search post types.


Description


Return

(array)


Source

File: inc/customizer/configurations/builder/header/class-astra-header-search-component-configs.php

	public function get_search_post_types_choices() {
		$all_post_types    = $this->get_live_search_posttypes();
		$post_type_choices = array();
		foreach ( $all_post_types as $post_type ) {
			$post_type_object = get_post_type_object( $post_type );
			/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
			$post_type_choices[ $post_type ] = ! empty( $post_type_object->labels->name ) ? $post_type_object->labels->name : $post_type;
			/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
		}
		return $post_type_choices;
	}

Changelog

Changelog
Version Description
4.4.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.