Show Media URL Column in WordPress Media Library

Help others by sharing this article

In my article, we learned how to show Media ID column in WordPress Media Library without Plugin. Do you know that you can also display media URL column in media library in WordPress without plugin? You can do this by adding a small code snippet which I am going to share in this article.

If you have lots of images and videos in your website, then you might be finding it difficult to find the URL of any specific media file. You can use this function to display media URL column in media library in WordPress without using any plugin as i didn’t want to use a plugin for something so simple.

We all love WordPress! It’s easy to use, and it’s easy to do everything you need. But sometimes it can feel like something’s missing—like that one thing you need to get your website looking and working just right.

If you’re reading this, you’ve probably been trying to figure out how to add a media URL column to the media library in WordPress without using a plugin. No judgment here: we’ve been there! We’ve tried finding plugins that do this, and they are… not good. So i spent a while trying to figure out how to do it myself, and today I am going to share what i found with you!

What is Media URL and what are its uses?

A media URL is a URL that contains the address of media files like images, audio, and video. WordPress Media Files allows users to upload their media files in WordPress.

A WordPress media URL can be used for different purposes. It can be used to show an image in the widget area. It can also be used to show an image in a post or page by using HTML. Users can also use the media URL to show their image on a custom script or theme.

Why should you display the media URL column in the media library?

Well, when you want to use an image from your media library in something like a blog post or page on your website, having the URL for that image displayed right there can save a bunch of time. No longer will you have to click on the image, copy the link from its details page, and then paste it into whatever new content you’re working on.

Also check:
Show Media ID column in Media Library WordPress
Show image dimensions column in media library without plugin
Automatically add WordPress image alt text without plugin
Display Post ID column in Post list WordPress

wpamit show media URL column in WordPress media library without plugin
Final result of the snippet provided in this article

Steps to Display Media URL column in WordPress Media Library

Before starting, you should:

  • Take a full backup of your website.
  • If you are not comfortable editing functions.php file then install this free plugin and add the snippet by using a single plugin.
  • Use a child theme to make customizations. Use this free plugin to create a child theme (you can delete the plugin after creating child theme, but do not delete the parent theme).

1). Login to your WordPress dashboard. Go to Appearance > Theme File Editor. Then Click on Theme Functions or functions.php

how to access theme file editor
Access Theme File Editor
how to access theme functions or functions.php
Access functions.php

2). Add below code at the bottom of the functions.php file, then click on Update File.

// Display or Add media URL column
function wpamit_add_media_url_column( $columns ) {
    $columns['media_url'] = 'URL';
    return $columns;
add_filter( 'manage_media_columns', 'wpamit_add_media_url_column' );
function media_url_column_data( $column_name, $id ) {
    if ( 'media_url' == $column_name ) {
        $url = wp_get_attachment_url( $id );
        echo '<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $url ) . '</a>';
add_action( 'manage_media_custom_column', 'media_url_column_data', 10, 2 );

It’s Done! Hope you learned how to display image URL column in Media Library without Plugin. If you have any queries or need any help, please comment below.

Help others by sharing this article

Leave a Reply

Your email address will not be published. Required fields are marked *