Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladimirlukyanov/a15f5d72a63d69729a86 to your computer and use it in GitHub Desktop.
Save vladimirlukyanov/a15f5d72a63d69729a86 to your computer and use it in GitHub Desktop.
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