Created
July 21, 2012 19:27
-
-
Save gyrus/3156901 to your computer and use it in GitHub Desktop.
Put WordPress custom post types in a global variable
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 | |
/** | |
* Store public custom post types in global variable | |
*/ | |
add_action( 'init', 'pilau_custom_post_types_var', 1 ); | |
function pilau_custom_post_types_var() { | |
global $pilau_custom_post_types; | |
$pilau_custom_post_types = get_post_types( array( | |
'public' => true, | |
'_builtin' => false | |
), 'objects', 'and' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment