Title: Error when using functions.php to include a custom post type
Last modified: August 20, 2016

---

# Error when using functions.php to include a custom post type

 *  [dtrickky](https://wordpress.org/support/users/dtrickky/)
 * (@dtrickky)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/error-when-using-functionsphp-to-include-a-custom-post-type/)
 * Hi there,
 * I’ve been developing a theme and ran into a few problems when trying to add custom
   post types and custom categories for the post type.
 * I went about this by creating the custom post type in a separate .php file and
   using the functions.php file to include the file (essentially simply “include(‘
   library/custom-post.php’)” within my functions file). This worked fine with custom
   menus and widgets, but was giving me the following error with the custom-post
   types file.
 * **Warning: call_user_func_array() [function.call-user-func-array]: First argument
   is expected to be a valid callback, ‘project-categories’ was given in wp-includes/
   plugin.php on line 405
 * To fix this, I simply copied over what was inside the custom-post.php file I 
   had created to include, and pasted it directly within the functions.php file.
   It worked, no problems at all.
 * Still, I’m stumped on why it would be giving me problems while using the include
   method. Any ideas?

The topic ‘Error when using functions.php to include a custom post type’ is closed
to new replies.

## Tags

 * [custom post](https://wordpress.org/support/topic-tag/custom-post/)
 * [custom posts](https://wordpress.org/support/topic-tag/custom-posts/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)

 * 0 replies
 * 1 participant
 * Last reply from: [dtrickky](https://wordpress.org/support/users/dtrickky/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/error-when-using-functionsphp-to-include-a-custom-post-type/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
