Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

As the title says I'm currently having some difficulties hiding the File URL option via jQuery.

I've been trying this:

// add_action( 'admin_footer-media.php', 'cor_remove_tr_file_url' );
add_action( 'admin_footer-media-new.php', 'cor_remove_tr_file_url' );
/**
 * Removes the 'File URL' row
 */
function cor_remove_tr_file_url() {
?>
<script>
jQuery(document).ready(function($){
  $('tr.image_url').remove()
});
</script>
<?php
}

which works great on media.php, but somehow it isn't working on media-new.php.

Would someone perhaps know what I might be overlooking here?

enter image description here

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This is because those elements aren't present when the page is finished loading, they're inserted later on using javascript.

Try hooking into #media-items and running your code when new elements are inserted rather than when the root element is ready.

share|improve this answer
    
Thanks, I wasn't aware of that. I'm now using a simple css version to hide things –  Cor van Noorloos Mar 2 '12 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.