attachment_fields_to_save

attachment_fields_to_save

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.1

apply_filters('attachment_fields_to_save') is found 3 times:

  • /wp-admin/includes/ajax-actions.php line 3224
    		wp_send_json_error();
    	}
    
    	/** This filter is documented in wp-admin/includes/media.php */
    	$post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
    
    	if ( isset( $post['errors'] ) ) {
    		$errors = $post['errors']; // @todo return me and display me!
    		unset( $post['errors'] );
    	}
    
    
  • /wp-admin/includes/media.php line 792
    			 *
    			 * @param array $post       An array of post data.
    			 * @param array $attachment An array of attachment metadata.
    			 */
    			$post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
    
    			if ( isset( $attachment['image_alt'] ) ) {
    				$image_alt = wp_unslash( $attachment['image_alt'] );
    
    				if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) {
    					$image_alt = wp_strip_all_tags( $image_alt, true );
    
  • /wp-admin/includes/post.php line 435
     
    		$attachment_data = isset( $post_data['attachments'][ $post_id ] ) ? $post_data['attachments'][ $post_id ] : array();
    
    		/** This filter is documented in wp-admin/includes/media.php */
    		$translated = apply_filters( 'attachment_fields_to_save', $translated, $attachment_data );
    	}
    
    	// Convert taxonomy input to term IDs, to avoid ambiguity.
    	if ( isset( $post_data['tax_input'] ) ) {
    		foreach ( (array) $post_data['tax_input'] as $taxonomy => $terms ) {
    			$tax_object = get_taxonomy( $taxonomy );
    

See this hook used in plugins: