Created
September 8, 2018 19:18
-
-
Save mdjwel/f4c9f03990cdafeeb5e3baaaf8a670ba to your computer and use it in GitHub Desktop.
Get post types array with name => singular name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get post types | |
function skima_post_types() { | |
$post_types = get_post_types([], 'objects'); | |
$posts = array(); | |
foreach ($post_types as $post_type) { | |
$posts[$post_type->name] = $post_type->labels->singular_name; | |
} | |
return $posts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment