Apply permissions per post

If you look at WordPress’s explanation of Roles and Capabilities, you will see that the correct role you should have assigned them is Author. That being said, if you for some reason don’t want to change them to Authors, you can alter the capabilities that a role has. See the full list of Editor capabilities … Read more

Get parse_query filter to return slug instead of id

taxonomy & term won’t be set (in this case), since query vars are mapped from GET/POST. In other words, $qv[‘large_feature’] = 291 (see wp_edit_posts_query() and WP_Query::get_posts() for the big picture). add_filter( ‘parse_query’,’convert_large_feature_id_to_taxonomy_term_in_query’ ); function convert_large_feature_id_to_taxonomy_term_in_query( $query ) { global $pagenow; $qv =& $query->query_vars; if ( $pagenow == ‘edit.php’ && isset( $qv[‘large_feature’] ) && ctype_digit( $qv[‘large_feature’] … Read more

Make the Status, Visibility, or Date fields opened by default in the Publish box

This jQuery code seems to work, when added via the admin_footer hook. #submitdiv = the whole Publish metabox .misc-pub-section = each UI section (except the Publish and Save sections) .hide-if-js = the fields that are hidden by default $(‘#submitdiv .misc-pub-section’) .has(“#post-status-display, #timestamp”) .find(‘.hide-if-js’) .toggle(); That will unhide the Status dropdown and the Date picker.

Customize my custom taxonomy table in Admin panel

This should do the trick: add_action( ‘admin_print_styles’, ‘cor_admin_print_styles’, 200 ); function cor_admin_print_styles() { $screen = get_current_screen(); if ( ‘edit-tags’ === $screen->base && ‘department’ === $screen->taxonomy ) { echo <<<EOF <style> .fixed .column-posts { width: auto; } .widefat .num, .column-comments, .column-links, .column-posts { text-align: left; } </style> EOF; } }

Globally register styles but enqueue them selectively

If you want the stylesheets registered in the backend, use the admin_enqueue_scripts action. function wp94156_register_styles() { wp_register_style( ‘your-stylesheet’, get_stylesheet_directory_uri() . ‘/your-stylesheet.css’, $deps, // optional $version // optional ); // since you only want it registered, we won’t enqueue it } add_action( ‘admin_enqueue_scripts’, ‘wp94156_register_styles’ );

SlideDeck 2, make back-end visible for admins only

Put the following in your functions.php: if (is_admin() && ! current_user_can(‘install_plugins’)) { add_action(‘admin_init’, ‘remove_slidedeck_menu_page’); add_action(‘admin_footer’, ‘remove_slidedeck_media_button’); } // remove the menu page function remove_slidedeck_menu_page() { remove_menu_page(‘slidedeck2-lite.php’); } // remove the button function remove_slidedeck_media_button() { echo <<<JQUERY <script> jQuery(document).ready(function($) { $(‘#add_slidedeck’).remove(); }); </script> JQUERY; } Note: I did test this. If something doesn’t work for you, … Read more