Skip to content

Instantly share code, notes, and snippets.

@jeremyfelt
Created May 7, 2012 00:32
Show Gist options
  • Save jeremyfelt/2625156 to your computer and use it in GitHub Desktop.
Save jeremyfelt/2625156 to your computer and use it in GitHub Desktop.
The results of 'public' => true and 'public' => false in register_post_type()
<?php
/* If public is not specified when registering a custom post type, false
* is used by default. */
$non_public_pt_args = array( 'public' => false );
/* The above is the same as specifying the following. */
$non_public_pt_args = array(
'public' => false,
'publicly_queryable' => false,
'exclude_from_search' => true,
'show_ui' => false,
'show_in_nav_menus' => false,
);
/* Setting public to true results in a different set of values */
$public_pt_args = array( 'public' => true );
/* The above is the same asa specifying the following. */
$public_pt_args = array(
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_ui' => true,
'show_in_nav_menus' => true,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment