Question: I have three different posts types registered:

```
register_post_type( 'foo' , $args );
register_post_type( 'bar' , $args );
register_post_type( 'baz' , $args );

```

When I am creating a new, say, "foo" post, I only want to save the meta box for "foo", what do I do?

add\_action('save\_post', 'save\_details');

So, if my post\_type were called "foo\_post":

```
add_meta_box( 
    $id, 
    $title, 
    $callback, 
    // SPECIFY THE POST TYPE HERE!!!
    "foo_post", 
    $context, 
    $priority, 
    $callback_args );

```

What do I do to save only "foo post" meta box when I am creating / edit a "foo post" page?

Answer: 
Since save\_post gives you the post\_id of the current post, you simply want to check what post\_type it is by using get\_post\_type($post\_id)

like:

```
add_action('save_post', 'save_details')

function save_details($post_id)
{
     $post_type = $_REQUEST['post_type'];

     if ('foo_post' == $post_type)
     {
          // save stuff for foo_post
     }
     elseif ('bar_post' == $post_type)
     {
          // save stuff for bar_post
     }
}

```

and so on...

[get\_post\_type() codex page](http://codex.wordpress.org/Function_Reference/get_post_type)
I assume you're talking about a *custom* post meta box? If so, then you need to ensure that you \*specify the `$posttype` when you call [`add_meta_box()`](http://codex.wordpress.org/Function_Reference/add_meta_box). e.g.:

```
<?php
add_meta_box( 
    $id, 
    $title, 
    $callback, 
    // SPECIFY THE POST TYPE HERE!!!
    $post_type, 
    $context, 
    $priority, 
    $callback_args );
?>

```

If you're *not* referring to a custom post meta box, then you'll need to provide more information, regarding what post meta box you're trying to manipulate.