0

I want to register a WordPress custom post type. This works perfectly fine in the functions.php, but not in my plugin file. The plugin does work except for registration of the CPT. The code is pretty standard.

Registering the CPT:

add_action( 'init', 'produkte_menu' );
function produkte_menu() {
register_post_type( 'produkte',
array(
'labels' => array(
'name' => 'Produkte' ),
'public' => true,
'menu_position' => 4,
'add_new' => '',
'supports' => array( 'title' ),
'taxonomies' => array( '' ),
'has_archive' => false,
'exclude_from_search' => true
)
);
}
function toggle_custom_menu_order(){
return true;
}

I don't want the editor for this CPT:

add_action('init', 'init_remove_support',100);
function init_remove_support(){
    $post_type = 'produkte';
    remove_post_type_support( $post_type, 'editor');
}

Finally, I hide the "add new" button:

add_action('admin_menu', 'hide_add_new_custom_type');
function hide_add_new_custom_type()
{
    global $submenu;
    unset($submenu['edit.php?post_type=produkte'][10]);
}

I'm stuck here. Any help would be appreciated!

  • 1
    Shouldn't be a problem. Post the surrounding plugin code. – s_ha_dum Dec 4 '13 at 15:28
  • For test purposes I deleted any other code but the plugin header. There is nothing else in it. – user2516117 Dec 4 '13 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.