Created
August 24, 2015 09:29
-
-
Save vladimirlukyanov/a15f5d72a63d69729a86 to your computer and use it in GitHub Desktop.
Add custom bulk action to Media Library WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_footer', 'custom_bulk_admin_footer'); | |
/** | |
* Step 1: add the custom Bulk Action to the select menus | |
*/ | |
function custom_bulk_admin_footer() { | |
global $pagenow; | |
if($pagenow == 'upload.php') { | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
jQuery('<option>').val('publish').text('<?php _e('Publish')?>').appendTo("select[name='action']"); | |
jQuery('<option>').val('publish').text('<?php _e('Publish')?>').appendTo("select[name='action2']"); | |
}); | |
</script> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment