Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add custom bulk action to Media Library WordPress
<?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