Title: save post
Last modified: August 20, 2016

---

# save post

 *  [STR-Ing](https://wordpress.org/support/users/str-ing/)
 * (@str-ing)
 * [15 years ago](https://wordpress.org/support/topic/save-post/)
 * hey guys !
 * Am not really sure that i could post that question over here… so, forgive me 
   if am wrong 🙂
    Moreover, i tried to search on the forum any solutions… without
   success or am blind 😉
 * Well, am looking for a hook that let me retrieve all the $_POST values when a
   post is edited/added… Here’s my code :
 *     ```
       add_action('admin_menu', 'post_options_box');
       add_action('save_post ', 'str_save_post');
   
       function post_options_box()
       {
       	add_meta_box('MetaBox', 'STRApp-It', 'str_draw_panel', 'post', 'side', 'high');
       	add_meta_box('MetaBox', 'STRApp-It', 'str_draw_panel', 'page', 'side', 'high');
       }
   
       function str_draw_panel()
       {
       	$target_content_values = array('key1' 				=> 'val1',
       								   'key2'		=> 'val2',
       								   'key3'				=> 'val3);
       	global $post;
       	$meta_values = get_post_meta($post->ID, '_target_content', false);
       	//var_dump($meta_values);
       	$action = 'add';
       	if (sizeof($meta_values) > 0) {
       		$action = 'update';
       	}
   
       	?>
       		<h4>Target</h4>
       		<input type="hidden" name="_target_content_action" value="<?php echo $action ?>" />
       		<?php
       			foreach ($target_content_values as $key => $value) {
       				$checked = '';
       				if($key == $meta_values[0])
       					$checked = 'checked';
       				?>
       					<input type="radio" name="_target_content" value="<?php echo $key ?>" <?php echo $checked ?> /><?php echo $value ?><br />
       				<?php
       			}
       		?>
       	<?php
       }
   
       function str_save_post($post_id, $post)
       {
       	var_dump($_POST);
       	die();
       }
       ```
   
 * unfortunately, i see that when i click on the update button in the admin panel,
   nobody comes in my str_save_post function… Does anybody know what am doing wrong??
 * As you can see, am starting plugin developments on WordPress and am a lil bit
   lost ! 😉
 * Thanks for your help guys !

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [STR-Ing](https://wordpress.org/support/users/str-ing/)
 * (@str-ing)
 * [15 years ago](https://wordpress.org/support/topic/save-post/#post-2099842)
 * My question is too dumb ? lol
 *  [TAN77](https://wordpress.org/support/users/tan77/)
 * (@tan77)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/save-post/#post-2100004)
 * use add_action(‘save_post’, ‘str_save_post’);
    without space in the name of action

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘save post’ is closed to new replies.

## Tags

 * [save_post](https://wordpress.org/support/topic-tag/save_post/)

 * 2 replies
 * 2 participants
 * Last reply from: [TAN77](https://wordpress.org/support/users/tan77/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/save-post/#post-2100004)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
