Title: Make Post Type Public
Last modified: August 21, 2016

---

# Make Post Type Public

 *  Resolved [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/make-post-type-public/)
 * Hi there,
 * Please make the content_block post type public, offer an option for this or provide
   a filter so it can be done without hacking the core code. I love this plugin 
   and use it frequently and one of the first things I always do is set it to be
   public.
 * Many thanks,
    Jonah
 * [https://wordpress.org/plugins/custom-post-widget/](https://wordpress.org/plugins/custom-post-widget/)

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Johan van der Wijk](https://wordpress.org/support/users/vanderwijk/)
 * (@vanderwijk)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4726849)
 * HI Jonah, I would be happy to provide a filter for making the content_block post
   type public in specific cases. Could you provide a code suggestion for implementing
   this?
 *  Thread Starter [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4726860)
 * Hi Johan,
 * Here you go:
    In /wp-content/plugins/custom-post-widget/post-widget.php:
 *     ```
       // Create the Content Block custom post type
       add_action( 'init', 'my_content_block_post_type_init' );
   
       function my_content_block_post_type_init() {
       	$labels = array(
       		'name' => _x( 'Content Blocks', 'post type general name', 'custom-post-widget' ),
       		'singular_name' => _x( 'Content Block', 'post type singular name', 'custom-post-widget' ),
       		'plural_name' => _x( 'Content Blocks', 'post type plural name', 'custom-post-widget' ),
       		'add_new' => _x( 'Add Content Block', 'block', 'custom-post-widget' ),
       		'add_new_item' => __( 'Add New Content Block', 'custom-post-widget' ),
       		'edit_item' => __( 'Edit Content Block', 'custom-post-widget' ),
       		'new_item' => __( 'New Content Block', 'custom-post-widget' ),
       		'view_item' => __( 'View Content Block', 'custom-post-widget' ),
       		'search_items' => __( 'Search Content Blocks', 'custom-post-widget' ),
       		'not_found' =>  __( 'No Content Blocks Found', 'custom-post-widget' ),
       		'not_found_in_trash' => __( 'No Content Blocks found in Trash', 'custom-post-widget' ),
       		'parent_item_colon' => ''
       	);
       	$content_block_public = false;
       	$options = array(
       		'labels' => $labels,
       		'public' => apply_filters( 'content_block_post_type', $content_block_public ),
       		'publicly_queryable' => false,
       		'exclude_from_search' => true,
       		'show_ui' => true,
       		'query_var' => true,
       		'rewrite' => true,
       		'capability_type' => 'post',
       		'hierarchical' => false,
       		'menu_position' => null,
       		'supports' => array( 'title','editor','revisions','thumbnail','author' )
       	);
       	register_post_type( 'content_block',$options );
       }
       ```
   
 * …and then the working filter:
 *     ```
       function filter_content_block_init() {
       	$content_block_public = true;
       	return $content_block_public;
       }
       add_filter('content_block_post_type','filter_content_block_init');
       ```
   
 * Might not be the most elegant (I’m no PHP pro) but it works!
 *  Plugin Author [Johan van der Wijk](https://wordpress.org/support/users/vanderwijk/)
 * (@vanderwijk)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4726900)
 * Hi Jonah,
 * I have updated the plugin with the suggested code. Could you please install and
   test this new version of the plugin: [http://downloads.wordpress.org/plugin/custom-post-widget.2.5.3.zip](http://downloads.wordpress.org/plugin/custom-post-widget.2.5.3.zip)
 * Please let me know if this works!
 *  Thread Starter [jonahcoyote](https://wordpress.org/support/users/jonahcoyote/)
 * (@jonahcoyote)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4726952)
 * Hey Johan,
 * Looks good to me, thanks for adding it!
 * – Jonah
 *  Plugin Author [Johan van der Wijk](https://wordpress.org/support/users/vanderwijk/)
 * (@vanderwijk)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4726960)
 * Great, I have just released the new version.
 *  [Peter](https://wordpress.org/support/users/bastimuc/)
 * (@bastimuc)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4727000)
 * Hi Jonah, Johan,
 * thanks but it doesn’t work for me. I have VC and Custom Post Widget installed–
   added the function_ .. to my functions.php but I still do not see the custom 
   posts available to select from in the visual composer. What am I doing wrong?
 * Also – other plugins that have WP widgets do not appear in the visual composer
   by default – any idea?
 * Thanks in advance,
    Seb
 *  [Dan Knauss](https://wordpress.org/support/users/dpknauss/)
 * (@dpknauss)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/make-post-type-public/#post-4727005)
 * Thanks guys, this was helpful.
 *  [Marc Queralt i Bassa](https://wordpress.org/support/users/marcqueralt/)
 * (@marcqueralt)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4727019)
 * Using [@jonahcoyote](https://wordpress.org/support/users/jonahcoyote/) advise
   a new plugin has been built.
    You can download it for free at [](http://demomentsomtres.com/english/wordpress-plugins/demomentsomtres-wpbakery-visual-composer-custom-post-widget/)
 *  [Marc Queralt i Bassa](https://wordpress.org/support/users/marcqueralt/)
 * (@marcqueralt)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4727020)
 * Using [@jonahcoyote](https://wordpress.org/support/users/jonahcoyote/) advise
   a new plugin has been built.
    You can download it for free at [DeMomentSomTres](http://demomentsomtres.com/english/wordpress-plugins/demomentsomtres-wpbakery-visual-composer-custom-post-widget/)
 *  [Palpatine1976](https://wordpress.org/support/users/palpatine1976/)
 * (@palpatine1976)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4727022)
 * Lovely enhancement! I was wondering if this was possible, and was very happy 
   to read this post 🙂

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Make Post Type Public’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-widget/assets/icon.svg?rev=2884166)
 * [Content Blocks (Custom Post Widget)](https://wordpress.org/plugins/custom-post-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-widget/reviews/)

 * 10 replies
 * 6 participants
 * Last reply from: [Palpatine1976](https://wordpress.org/support/users/palpatine1976/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/make-post-type-public/#post-4727022)
 * Status: resolved