• I’ve created a custom post type with the following:

    function
    create_post_types ()
    {
    	register_post_type ('my_custom_post_type',
    		array (
    			'labels' => array (
    				'name' => 'My Name',
    				'singular_name' => 'My Name',
    				'all_items' => 'All My Names',
    				'add_new_item' => 'Add New My Name',
    				'edit_item' => 'Edit My Name',
    				'new_item' => 'New My Name',
    				'view_item' => 'View My Name',
    				'search_items' => 'Search My Names',
    				'not_found' => 'No my names found',
    				'not_found_in_trash' => 'No my names found in Trash'
    				),
    			'public' => false,
    			'menu_position' => 5,
    			'has_archive' => false,
    			'supports' => array (
    				'title', 'editor', 'author', 'revisions', 'page-attributes'
    				),
    			'show_ui' => true
    			)
    		) ;
    }
    add_action ('init', 'create_post_types') ;

    When I’m in the “All My Names” screen in the admin module (i.e., post.php?post_type=my_custom_post_type) and I enter something in the search box and click the “Search My Names” button, I would expect to see only posts with post_type=’my_custom_post_type’ that contain my search terms (in the title and/or content). However, in addition to that, I’m seeing posts with post_type=’post’.

    Is there something else I need to add to my register_post_type() call so that the admin module works the way I expect it to?

  • The topic ‘edit.php: searching in custom post types’ is closed to new replies.