Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Copyrightfeld
- */
- function be_attachment_field_credit( $form_fields, $post ) {
- $form_fields['be-photographer-name'] = array(
- 'label' => 'Copyright',
- 'input' => 'text',
- 'value' => get_post_meta( $post->ID, 'be_photographer_name', true ),
- );
- return $form_fields;
- }
- add_filter( 'attachment_fields_to_edit', 'be_attachment_field_credit', 10, 2 );
- /**
- * Save values of Photographer Name and URL 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
- */
- function be_attachment_field_credit_save( $post, $attachment ) {
- if( isset( $attachment['be-photographer-name'] ) )
- update_post_meta( $post['ID'], 'be_photographer_name', $attachment['be-photographer-name'] );
- return $post;
- }
- add_filter( 'attachment_fields_to_save', 'be_attachment_field_credit_save', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement