# Include attachment URL in another attribute's description

**URL:** <https://community.hivepress.io/t/include-attachment-url-in-another-attributes-description/4587>\
**Category:** HivePress\
**Created:** [February 26, 2023, 7:56pm UTC](https://community.hivepress.io/t/include-attachment-url-in-another-attributes-description/4587 "2023-02-26T19:56:07Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![ruurdniepoth](https://community.hivepress.io/letter_avatar_proxy/v4/letter/r/e68b1a/32.png) [@ruurdniepoth](https://community.hivepress.io/u/ruurdniepoth)\
**Post date:** [February 28, 2023, 4:32pm UTC](https://community.hivepress.io/t/include-attachment-url-in-another-attributes-description/4587/12 "2023-02-28T16:32:58Z")

</div>

Hi again,

I further investigated to pull the data and by combining the `wp_get_attachment_url()` with the listing attachment attribute field value to lookup the URL. See the solution below in the filter.

Would you agree this is a solid solution?

```auto
add_filter(
	'hivepress/v1/forms/booking_confirm',
	function($form_args, $form){
		$booking = $form->get_model();
		
		if(!$booking){
			return $form_args;
		}
		
		$listing = $booking->get_listing();
		
		if(!$listing || !$listing->get_put_your_url_attribute_field_name()){
			return $form_args;
		}
		
		$field_name = 'hp_algemene_voorwaarden'; // replace my_custom_field with the name of your custom field
		$attachment_post_id = $listing->get_algemene_voorwaarden();
		$attachment_url = wp_get_attachment_url( $attachment_post_id );
		echo $attachment_url;
		
		if(isset($form_args['fields']['algemene_voorwaarden'])){
			$form_args['fields']['algemene_voorwaarden']['description'] = '<a href="'.esc_url($attachment_url).'" target="_blank" rel="noopener">Custom text</a>';
		}
		
		return $form_args;
	},
	1000,
	2

```

---

_[View the full topic](https://community.hivepress.io/t/include-attachment-url-in-another-attributes-description/4587)._
