Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Admin_Helpers::post_type_dropdown_options( array $args = array(),  $compare = 'and' )


Description Description


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Parameters Parameters

$args

(Optional)

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

File: classes/Admin/Helpers.php

	public static function post_type_dropdown_options( $args = array(), $compare = 'and' ) {
		$args = wp_parse_args( $args, array(
			'public'              => null,
			'publicly_queryable'  => null,
			'exclude_from_search' => null,
			'show_ui'             => null,
			'capability_type'     => null,
			'hierarchical'        => null,
			'menu_position'       => null,
			'menu_icon'           => null,
			'permalink_epmask'    => null,
			'rewrite'             => null,
			'query_var'           => null,
			'_builtin'            => null,
		) );

		foreach( $args as $key => $value ) {
			if ( $value === null ) {
				unset( $args[ $key ] );
			}
		}

		$options = array();

		foreach ( get_post_types( $args, 'objects', $compare ) as $post_type ) {
			if ( in_array( $post_type->name, array( 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'popup_theme', 'nf_sub' ) ) ) {
				// continue;
			}

			$labels = get_post_type_labels( $post_type );

			$options[ esc_attr( $post_type->name ) ] = esc_html( $labels->name );
		}

		return $options;
	}

Top ↑

User Contributed Notes User Contributed Notes

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