Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type created called 'missions'. When developing the site on my Dedicated Virtual, I had no problems. But I moved the site to a shared hosting grid server (mt) and now receive this error through out the admin.

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'add_mission' was given in /nfs/c08/h02/mnt/125591/domains/mydomain.org/html/wp-includes/plugin.php on line 395

The only place that 'add_mission' is used in my theme code is in the functions when setting up the post type. Here is the code I have for that.

add_action( 'init', 'create_mission' );
function create_mission() {
    register_post_type( 'missions',
        array(
            'labels' => array(
                'name' => __( 'Missions' ),
                'singular_name' => __( 'Mission' ),
                'add_new' => __( 'Add New' ),
                'add_new_item' => __( 'Add New Mission' ),
                'edit' => __( 'Edit' ),
                'edit_item' => __( 'Edit Mission' ),
                'new_item' => __( 'New Mission' ),
                'view' => __( 'View Mission' ),
                'view_item' => __( 'View Mission' ),
                'search_items' => __( 'Search Missions' ),
                'not_found' => __( 'No missions found' ),
                'not_found_in_trash' => __( 'No missions found in Trash' ),
                'parent' => __( 'Parent Mission' ),
            ),
            'public' => true,
            'menu_position' => 4,
            'show_ui' => true,
            'capability_type' => 'post',
            '_edit_link' =>  'post.php?post=%d',
            'hierarchical' => true,
            'rewrite' => array( 'slug' => 'missions', 'with_front' => true ),
            'supports' => array( 
                        'title',
                        'editor',
                        'author',
                        'thumbnail',
                        'excerpt',
                        'trackbacks',
                        'custom-fields',
                        'comments' ,
                        'page-attributes',
                        'templates' ),
            'menu_icon' => get_stylesheet_directory_uri() . '/assets/imgs/icon_posttype.png',
            'register_meta_box_cb' => 'add_mission_metaboxes'
        )
    );
}
add_action('admin_init', 'add_mission');

More Info

I know that the issue is with my theme, as switching to the twentyten theme removes the error.

PHP Version 5.2.14

WordPress 3.1.2

Question

Is this a server issue? Or can I fix this through my code?

I've searched google and have been unable to find an instance of this error being thrown from a custom post type in wordpress.

share|improve this question
2  
what's the add action at the bottom doing? It's not required for setting up CPTs, just the setup bit you have running on init.... I believe that is what's throwing the error –  Rev. Voodoo May 4 '11 at 18:44
    
And that seems to have been the problem. It was old code, referencing a different meta box approach I had tried earlier. I wonder why the error wasn't thrown in the DV server. Thank you sir! –  Chad Von Lind May 4 '11 at 18:53
    
I'm a SE n00b, and cannot figure out how to mark your response as an answer. :( –  Chad Von Lind May 4 '11 at 19:04
    
I re-posted it as an answer, thank you for reporting back! –  Rev. Voodoo May 4 '11 at 19:31
add comment

1 Answer

up vote 1 down vote accepted

what's the add action at the bottom doing? It's not required for setting up CPTs, just the setup bit you have running on init.... I believe that is what's throwing the error

I have to make it an answer. It was a suggestion, but if it worked for you, I'll make my comment an answer, then you can accept it!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.