• Resolved agm285

    (@agm285)


    This was working before. I was able to see the meta box fields in my dashboard. (I couldn’t save meta field data, but that’s another topic.)

    Now I can’t even get the meta data to appear. I can see the Concerts post type, and the Add New button, but I don’t see the fields. I’m probably missing something obvious. Again, there’s no ‘save’ code but the meta box fields should be showing up.

    Here’s my code:

    // Register our new custom post type CONCERT
    function register_concert_type() {
    	register_post_type( 'concerts',
    		array(
    			'label' => 'Concerts',
    			'labels' => array(
    				'name'=>'Concerts',
    				'singular_name'=>'Concert'),
    			'public' => true,
    			'menu_position' => 5,
    			'supports' => array( 'title')
    		)
    	);
    }
    add_action( 'init', 'register_concert_type' );
    
    // ADD "CONCERT" META BOX:
    function add_concert_meta() {
    	add_meta_box(
    		"concert_details_meta",
    		"Concert Details",
    		"concert_details",
    		"concert"
    	);
    }
    add_action('admin_init', 'add_concert_meta');
    //add_action('add_meta_boxes', 'add_concert_meta' );
    
    // Add custom fields:
    function concert_details(){
    	global $post; // Is this needed?
    	//wp_nonce_field( plugin_basename( __FILE__ ), 'concert_details_nonce' );
    	$concert = get_post_custom($post->ID);
    	$date = $concert["date"][0];
    	?>Concert Date: <input name="date" id="date" value="<?php echo htmlspecialchars($date); ?>" ><br>
    	<?php
    }
Viewing 1 replies (of 1 total)
  • Thread Starter agm285

    (@agm285)

    FOUND IT: I changed the post-type from “concert” to “concerts” but failed to update the add_concert_meta post-type name to match.

    Should be:

    // ADD "CONCERT" META BOX:
    function add_concert_meta() {
    	add_meta_box(
    		"concert_details_meta",
    		"Concert Details",
    		"concert_details",
    		"concerts" // Changed to plural
    	);
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Meta box doesn't appear’ is closed to new replies.