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)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘save post’ is closed to new replies.