m3o6pg
Last Updated: February 25, 2016
·
453
· rajeshkhatri13

Add image url column in Media at Wordpress Dashboard

<h1>Add image url column in Media at Wordpress Dashboard, to easy copy image path</h1>

<h2>Copy below code and paste in your theme's <i>function.php</i> file</h2>

function muccolumn( $cols ) {
        $cols["mediaurl"] = "URL";
        return $cols;
}
function mucvalue( $columnname, $id ) {
        if ( $columnname == "mediaurl" ) echo '<input type="text" width="100%" onclick="jQuery(this).select();" value="'. wpgetattachmenturl( $id ). '" />';
}
addfilter( 'managemediacolumns', 'muccolumn' );
addaction( 'managemediacustomcolumn', 'mucvalue', 10, 2 );
</code></pre>
Say Thanks
Respond