Skip to content

Instantly share code, notes, and snippets.

@wpmark
Created September 23, 2014 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmark/86a965d71a6a7333ddd9 to your computer and use it in GitHub Desktop.
Save wpmark/86a965d71a6a7333ddd9 to your computer and use it in GitHub Desktop.
Alter the Registered Post Type Args for Any Post Type
<?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