astra_customizer_search_post_types_choices()

Get formatted live search post types.


Description


Return

(array)


Source

File: inc/extras.php

function astra_customizer_search_post_types_choices() {
	$all_post_types    = astra_customizer_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.