AgilityWeb
3/30/2017 - 7:35 PM

WP- Add file URL to Media Library Admin

WP- Add file URL to Media Library Admin

#-----------------------------------------------------------------#
# Add file URL to Media Library
#-----------------------------------------------------------------#

	function muc_column( $cols ) {
        $cols["media_url"] = "URL";
        return $cols;
		}
	function muc_value( $column_name, $id ) {
        if ( $column_name == "media_url" ) echo '<input type="text" width="100%" onclick="jQuery(this).select();" value="'. wp_get_attachment_url( $id ). '" readonly="true" />';
	}
	add_filter( 'manage_media_columns', 'muc_column' );
	add_action( 'manage_media_custom_column', 'muc_value', 10, 2 );
	function muc_column( $cols ) {
        $cols["media_url"] = "URL";
        return $cols;
		}
	function muc_value( $column_name, $id ) {
        if ( $column_name == "media_url" ) echo '<input type="text" width="100%" onclick="jQuery(this).select();" value="'. wp_get_attachment_url( $id ). '" readonly="true" />';
	}
	add_filter( 'manage_media_columns', 'muc_column' );
	add_action( 'manage_media_custom_column', 'muc_value', 10, 2 );