| @@ -4,10 +4,17 @@ | ||
| 4 | 4 | |
| 5 | 5 | public function __construct() |
| 6 | 6 | { |
| 7 | 7 | add_action( 'save_post', array( $this, 'save' ), 10, 2 ); |
| 8 | + add_action( 'edit_attachment', array( $this, 'save_attachment' ) ); | |
| 8 | 9 | } |
| 9 | 10 | |
| 11 | + public function save_attachment( $post_id ) | |
| 12 | + { | |
| 13 | + $post = get_post( $post_id ); | |
| 14 | + $this->save( $post_id, $post ); | |
| 15 | + } | |
| 16 | + | |
| 10 | 17 | public function save( $post_id, $post ) |
| 11 | 18 | { |
| 12 | 19 | if( $post->post_type != WPUPG_POST_TYPE ) |
| 13 | 20 | { |
| @@ -16,9 +23,12 @@ | ||
| 16 | 23 | } |
| 17 | 24 | |
| 18 | 25 | // Basic metadata |
| 19 | 26 | $fields = array( |
| 20 | - 'wpupg_custom_link' | |
| 27 | + 'wpupg_custom_link', | |
| 28 | + 'wpupg_custom_link_behaviour', | |
| 29 | + 'wpupg_custom_image', | |
| 30 | + 'wpupg_custom_image_id', | |
| 21 | 31 | ); |
| 22 | 32 | |
| 23 | 33 | foreach ( $fields as $field ) |
| 24 | 34 | { |