Make Categories and Tags required in admin

The JavaScript function is a bit wrong, its catching the form submit instead of the button click change it to this: function my_publish_admin_hook(){ if(is_admin()) { echo” <script language=\”javascript\” type=\”text/javascript\”> jQuery(document).ready(function() { jQuery(‘#publish’).click(function() { var form_data = jQuery(‘#post’).serializeArray(); form_data = jQuery.param(form_data); var data = { action: ‘my_pre_submit_validation’, security: ‘”;echo wp_create_nonce( ‘pre_publish_validation’ ); echo”‘, form_data: form_data }; … Read more

initial sort order for a sortable custom column in admin

Instead of adding your column label “view” as a string, pass it in as an array with 1 as the second value. Like this: array(‘view’,1) Full Code: add_filter( ‘manage_edit-post_sortable_columns’, ‘my_sortable_view_column’ ); function my_sortable_view_column( $columns ) { $columns[‘post_views’] = array(‘view’,1); return $columns; } I don’t have a WP Codex for this, but I found someone else … Read more

WordPress Admins or Roles per Page

I recommend 2 plugins: User Role Editor: This plugin allows you create new roles and adjust their capabilities. Hide Admin Menu: This plugin allows you hide menu items based on user role. You just need to select which menu items will be hidden for curtain roles.

How to remove row-actions from pages table?

For non-hierarchical post types the filter is called post_row_actions, for hierarchical it’s page_row_actions. If you want to remove all actions you don’t have to unset the individual items, you can just return an empty array. add_filter( ‘page_row_actions’, ‘wpse16327_page_row_actions’, 10, 2 ); function wpse16327_page_row_actions( $actions, $post ) { if ( ‘page’ == $post->post_type ) { return … Read more

Can a users profile be put under the dashboard menu

You could just write a custom Dashboard Widget: Tutorial How to Add Custom Dashboard Widgets in WordPress In this article we will show you how you can customize dashboard widgets in WordPress. Documentation Dashboard Widgets API The Dashboard Widgets API (added in WP 2.7) makes it very simple to add new widgets to the administration … Read more

Is there a more efficient admin search function/plugin?

Altering the WHERE clause There’s a filter named posts_search that allows to filter the SQL WHERE clause used for the query during search (when WP_Query::is_search() returns true and WP_Query->s is set): add_filter( ‘posts_search’, ‘wpse134392PostsSearchSQL’, 20, 2 ); function wpse134392PostsSearchSQL( $sql, $wp_query ) { // Alter SQL clause here return $where; } Custom ORDERBY To intercept … Read more

How to add icons to post listing (edit.php) in admin

We can style the table with CSS and dashicons. Example: For our video category, we can use for example: .edit-php .wp-list-table tr.category-video td.post-title strong:before { content: “\f126”; color: #ccc; display: inline-block; width: 20px; height: 20px; margin: 0 4px; font-size: 20px; line-height: 20px; font-family: “dashicons”; font-weight: normal; vertical-align: top; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } where we … Read more