'Copyright', 'input' => 'text', 'value' => get_post_meta($post->ID, 'copyright', true) ); $form_fields['terms'] = array( 'label' => 'Terms &
Conditions
', 'input' => 'text', 'value' => get_post_meta($post->ID, 'terms', true) ); return $form_fields; } /** * Save values of Copyright and Terms & Condition in media uploader * * @param $post array, the post data for database * @param $attachment array, attachment fields from $_POST form * @return $post array, modified post data */ public static function canto_be_attachment_field_credit_save($post, $attachment) { if (isset($attachment['copyright'])) { update_post_meta($post['ID'], 'copyright', $attachment['copyright']); } if (isset($attachment['terms'])) { update_post_meta($post['ID'], 'terms', esc_url($attachment['terms'])); } return $post; } public function get_placeholder_html() { $html = '
'; $html .= ''; $html .= __('Select from Canto', 'canto'); $html .= '
'; return $html; } } // Register the filter hooks with the static class methods add_filter('attachment_fields_to_edit', ['Canto_Attachment', 'canto_be_attachment_field_credit'], 10, 2); add_filter('attachment_fields_to_save', ['Canto_Attachment', 'canto_be_attachment_field_credit_save'], 10, 2);