Advertisements

image_attachment_fields_to_save

Definition:
function image_attachment_fields_to_save($post, $attachment) {}

Parameters

  • unknown_type $post
  • unknown_type $attachment

Source code

function image_attachment_fields_to_save($post, $attachment) {

	if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {

		if ( strlen(trim($post['post_title'])) == 0 ) {

			$post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));

			$post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');

		}

	}



	return $post;

}

1981

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: