Title: Array for &#039;all&#039; custom post types?
Last modified: August 20, 2016

---

# Array for 'all' custom post types?

 *  [Stefan](https://wordpress.org/support/users/stefan83/)
 * (@stefan83)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/)
 * When creating a query array for custom post types, is there a way of including
   all types without having to list them all as they are created?
 * for example
 *  `'post_type' => array ('post', 'blog-item', 'company-spotlight', 'ebook', 'podcast','
   photo-gallery', 'presentation-slide', 'video', 'white-paper'),`
 * would look something like:
 * `'post_type' => array ('post', 'ALL_CUSTOM_POST_TYPES'),`

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

 *  [Slobodan K](https://wordpress.org/support/users/wpcanyon/)
 * (@wpcanyon)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/#post-3353073)
 * Try this.
 *     ```
       $post_types = get_post_types( '','names' );
       ...
       'post_type' => $post_types,
       ```
   
 *  Thread Starter [Stefan](https://wordpress.org/support/users/stefan83/)
 * (@stefan83)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/#post-3353098)
 * Thanks wpcanyon, so there isn’t an array for all custom post types?
 *  [Slobodan K](https://wordpress.org/support/users/wpcanyon/)
 * (@wpcanyon)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/#post-3353099)
 * Ahh sorry, i was wrong. Just remembered there’s this…
 *     ```
       'post_type' => 'any',
       ```
   
 *  Thread Starter [Stefan](https://wordpress.org/support/users/stefan83/)
 * (@stefan83)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/#post-3353111)
 * Awesome, thanks wpcanyon!
 * I also want to register the following function for adding tags metaboxes to ‘
   any’ post type but it doesn’t work? Any ideas?
 *     ```
       function demo_add_default_boxes() {
       register_taxonomy_for_object_type('post_tag', 'any');
       }
       ```
   
 *  [Slobodan K](https://wordpress.org/support/users/wpcanyon/)
 * (@wpcanyon)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/#post-3353127)
 * I don’t think there’s a value for all. And that second parameter (for the post
   type) is for a single post type.
 * Why don’t you attach the post_tag taxonomy directly in the register_post_type
 *     ```
       register_post_type( 'post_type_name', array(
           'taxonomies' => array( 'post_tag' ),
           'blah blah' => 'blah blah'
           ...
       ));
       ```
   

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

The topic ‘Array for 'all' custom post types?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Slobodan K](https://wordpress.org/support/users/wpcanyon/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/array-for-all-custom-post-types/#post-3353127)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
