Created
September 23, 2014 20:25
-
-
Save wpmark/86a965d71a6a7333ddd9 to your computer and use it in GitHub Desktop.
Alter the Registered Post Type Args for Any Post Type
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 | |
/*************************************************************** | |
* Function bct_make_whistles_public() | |
* Sets the whistles post type to be public | |
***************************************************************/ | |
function bct_make_whistles_public( $post_type, $args ) { | |
/* only proceed for the whistles post type */ | |
if ( 'whistle' != $post_type ) | |
return; | |
global $wp_post_types; | |
/* set post type to public */ | |
$args->public = true; | |
/* modify post type object to implement the changes */ | |
$wp_post_types[ $post_type ] = $args; | |
} | |
add_action( 'registered_post_type', 'bct_make_whistles_public', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment