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.