$public, '_builtin' => true, ); $post_types_builtin = get_post_types( $args_builtin, 'objects' ); // Fetch custom post types. $args_custom = array( 'public' => $public, '_builtin' => false, ); $post_types_custom = get_post_types( $args_custom, 'objects' ); // Converge or pick post types based on selection. switch ( $value ) { case 'builtin' : $post_types = $post_types_builtin; break; case 'custom' : $post_types = $post_types_custom; break; default : $post_types = array_merge( $post_types_builtin, $post_types_custom ); break; } return $post_types; }