If understand your question correctly, I think this can get the job done. Use get_attachment_link
instead of wp_get_attachment_url
and then echo the title.
<?php
$attachment_id = 2582;
$attachment_page = get_attachment_link( $attachment_id );
?>
<a href="https://wordpress.stackexchange.com/questions/255020/<?php echo $attachment_page; ?>"><?php echo get_the_title($attachment_id ); ?></a>
Related Posts:
- Update media file url in wordpress media library
- How to make media URLs Unique
- How to Fix HTTP Error When Uploading Images?
- Unwanted media library URLs in posts?
- How can I bulk delete media and attachments using WP-CLI?
- Get all posts (of any post type) an attachment is used in
- Password protect some uploaded files, so only logged-in users can view them
- Unattaching unlinked images
- Pages redirected to attachment post
- How to retrieve alt attribute for an attachment (uploaded image)?
- How to fetch only media that was already attached to a post/page?
- Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]
- Post edit – Media Library – Only get images from current post
- Attach media to multiple posts
- Set a custom URL for image in the Media Library?
- How do I modify the “Insert Media” lightbox in the admin to only show media items from a category?
- How can I change a media attachment URL/slug, so that I can use that slug for a page?
- Find file url in post content and add it to media library
- What template is used for viewing Media Library Files?
- Get images attached to a specific page
- WordPress Attachments with old images
- Uploaded images result in a file url with full path on disk appended
- get all images from the wordpress media library with link to the post they are associated with
- How to get a page url segment on wordpress?
- How can i set media attachments to the author of the post or page for already existed posts with attachments
- Media Library Mess After FTP … /uploads
- Adding attachment custom field metadata to TinyMCE tag
- How to get the correct URL on my wordpress site?
- controlling whether upload is attached to post or not
- Media library only show 2 items per page?
- Replace media external links with local links
- Use a template file for a specific url without creating a page
- How does routing on wordpress work?
- Redirecting to old domain after migration
- How to show all available images in WP’s media library when using the Polylang plugin?
- How to remove file versions from the file source links in wp_head?
- Changing attachment urls?
- How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS
- Append button to WordPress Image Details modal
- Get the attachment URL on single.php
- As soon as I add a custom query_var using the filter, my pages point to an archive page – why?
- How to disable WordPress Media resize different size version?
- How to count media attachments?
- Best way of removing emoji support from url / slug only
- Password protected page Hash url
- How do I override the emoji url?
- Site broken after using URL Change in Admin
- Only displaying zip files with wp media
- Custom Post type permalink structure with custom_post_id
- Setting a url for a page
- Duplicate Custom Header Functionality into the post edit screen
- Uppload image from another source wp.media
- 404 error when passing “cat” parameter to URL
- Is it possible to configure WordPress’s Core Files to accept duplicate Child Categories?
- My Media Library is broken across all my subsites
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- How to select multiple media files for a widget form?
- How to get the return value of wp.media({ frame: ‘post’ }) in all cases?
- how to trace a file by the route url
- Massive photogallery import
- How to load attachment in media library for current user?
- Block direct url enter
- How do you make homepage redirect to it’s slashed version?
- Can i have access to my WordPress Website again?
- How can I make my blog urls have words of the title in them?
- Change URLs depending on alias
- Passing values through url for checkbox fields with same name to get?
- Migrating media files (documents only) to a fresh install and maintaining the same directory structure
- Upload multiple image with media_handle_upload with multiple file field [duplicate]
- Alternatives to site_url() and get_template_directory_uri()
- Replace category name with article id in wordpress urls
- Redirect Old wordpress url to new wordpress url
- custom url – add attachment’s id or name after post
- Theming media inserts
- WordPress Primary Category Changes After Import, Permalink Issue
- how can I change all wordpress media file url to custom cdn url?
- How to set wordpress url on local host to access it via VPN
- unique url access control
- Can’t upload format files on media library
- How to get custom URL routes property_id in wp php plugin?
- How to Override Page Template if URL matches query?
- index.php shows up in url
- unsharp thumbnails after uploading image
- Swap out a page that is a parent to a many many pages
- Avoiding the -2 in slugs
- Let WordPress to go opening an external URL
- Change default query parameters
- Attachments plugin cannot click media library button [closed]
- problem getting audio url
- How to get only current images of a post
- How to eliminate the Web Address / Web Link textbox from comment forms
- Broken Media Library
- URL displays different page (a loop)?
- Change path/url of admin-bar.min.css
- Why is my WordPress install using full server directory paths for media URLs?
- Accidentally Changed WordPress Url
- Typing local WordPress URL works, but clicking the same link does not
- How to create multiple urls for a same page contents in wordpress
- Media library upload hook
- upload image to wordpress media library failed for custom post type