• Hi I have a meta box I’m trying to enable in custom post types but I can’t see what’s wrong with the following code. Can anyone help?

    Thanks

    function meta_box() {
    	if ( function_exists( 'get_post_types' ) ) {
    		$post_types = get_post_types( array(), 'objects' );
    		foreach ( $post_types as $post_type ) {
    			if ( $post_type->show_ui ) {
    				add_meta_box( 'Publish to twitter', 'twitter', array( 'add_twitter_metabox', 'noindex_option_fill' ), $post_type->name, 'side' );
    				add_meta_box( 'Add to the slider', 'slider', array( 'add_slider_metabox', 'noindex_option_fill' ), $post_type->name, 'side' );
    			}
    		}
    	} else {
    	add_meta_box( 'twitterbox', __('Publish to twitter', 'twitter'), 'add_twitter_metabox', 'post', 'normal', 'high');
    	add_meta_box( 'sliderbox', __('Add to the slider', 'slider'), 'add_slider_metabox', 'post', 'normal', 'high');
    	}
    }
Viewing 1 replies (of 1 total)
  • Thread Starter Stefan

    (@stefan83)

    I get the following error message in the edit post interface: Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘add_metaboxes’ was given in /home/undergro/public_html/wp-includes/plugin.php on line 405

Viewing 1 replies (of 1 total)
  • The topic ‘Add meta box to custom post’ is closed to new replies.