Title: Code doesn&#039;t work with custom post type
Last modified: August 30, 2016

---

# Code doesn't work with custom post type

 *  [Kyprulez](https://wordpress.org/support/users/kyprulez/)
 * (@kyprulez)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-work-with-custom-post-type/)
 * I have this following set-up which works perfectly until I assign the template
   cu a custom post type:
 * [Associated Diseases]
    type = checkbox code = 0
 * CODE #0
 *     ```
       $args = array("post_type" => "disease",
                     "posts_per_page" => "-1"
                    );
       $diseases = new WP_Query($args);
   
       if ( $diseases->have_posts() ) {
           while ( $diseases->have_posts() ) {
               $diseases->the_post();
       	$values[] = get_the_ID();
       	$valueLabels[] = get_the_title();
           }
       }
       ```
   
 * The question has also been asked here 1 year ago:
    [http://wordpress.stackexchange.com/questions/119905/custom-field-template-missing-for-some-custom-post-types](http://wordpress.stackexchange.com/questions/119905/custom-field-template-missing-for-some-custom-post-types)
 * May this be solved, please? I really need that CPT assignment.
 * Thank you!
 * [https://wordpress.org/plugins/custom-field-template/](https://wordpress.org/plugins/custom-field-template/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [Kyprulez](https://wordpress.org/support/users/kyprulez/)
 * (@kyprulez)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-work-with-custom-post-type/#post-6240612)
 * Edit: if I set it to “select”, it works. It doesn’t work for “checkbox”, though.

Viewing 1 replies (of 1 total)

The topic ‘Code doesn't work with custom post type’ is closed to new replies.

 * ![](https://ps.w.org/custom-field-template/assets/icon-256x256.png?rev=1966286)
 * [Custom Field Template](https://wordpress.org/plugins/custom-field-template/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-field-template/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-template/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-template/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-template/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-template/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Kyprulez](https://wordpress.org/support/users/kyprulez/)
 * Last activity: [10 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-work-with-custom-post-type/#post-6240612)
 * Status: not resolved