Skip to content

Instantly share code, notes, and snippets.

@alexkingorg
Last active December 17, 2015 13:59
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 alexkingorg/5621202 to your computer and use it in GitHub Desktop.
Save alexkingorg/5621202 to your computer and use it in GitHub Desktop.
Hide unused post formats in WordPress 3.6.
<?php
/*
Plugin Name: AK.org Hide Post Format Tabs
Plugin URI: https://gist.github.com/alexkingorg/5557869
Description: Reduce the footprint of the post format tabs in the WordPress admin UI.
Version: 1.0
Author: Alex King
Author URI: http://alexking.org
License: GPL2
*/
function akv3_remove_format_tabs() {
?>
<script type="text/javascript">
jQuery(function($) {
// SET THIS TO YOUR UNUSED FORMATS
// image, gallery, link, video, audio, chat, status, quote, aside
var unusedFormats = ['aside', 'chat', 'audio'];
$('.post-format-options a').each(function() {
var format = $(this).data('wp-format');
if ($.inArray(format, unusedFormats) !== -1) {
$(this).remove();
}
});
});
</script>
<?php
}
add_action('admin_head-post.php', 'akv3_remove_format_tabs');
add_action('admin_head-post-new.php', 'akv3_remove_format_tabs');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment