Hide other users’ posts in admin panel

Here is what I use: // Show only posts and media related to logged in author add_action(‘pre_get_posts’, ‘query_set_only_author’ ); function query_set_only_author( $wp_query ) { global $current_user; if( is_admin() && !current_user_can(‘edit_others_posts’) ) { $wp_query->set( ‘author’, $current_user->ID ); add_filter(‘views_edit-post’, ‘fix_post_counts’); add_filter(‘views_upload’, ‘fix_media_counts’); } } // Fix post counts function fix_post_counts($views) { global $current_user, $wp_query; unset($views[‘mine’]); $types = … Read more

Edit “thank you for creating with WordPress” in version 3.3.1

Credit definitely goes to @kaiser, but here is a full working solution. You can add this code to your functions.php file (in your theme): function wpse_edit_footer() { add_filter( ‘admin_footer_text’, ‘wpse_edit_text’, 11 ); } function wpse_edit_text($content) { return “New Footer Text”; } add_action( ‘admin_init’, ‘wpse_edit_footer’ );

What are the best practices for updating?

Do not just upgrade immediately. Take the time you need for an informed decision. And make a backup, of course. 🙂 Read the changelog for the new version. Example for 3.4.1. The blog announcements and the Codex pages are not complete. Test the upgrade with an exact copy of your production site, including plugins and … Read more

How To Remove WordPress Version From The Admin Footer

Add this to your functions.php: function my_footer_shh() { remove_filter( ‘update_footer’, ‘core_update_footer’ ); } add_action( ‘admin_menu’, ‘my_footer_shh’ ); or, if you’d like to hide it from everyone except admins: function my_footer_shh() { if ( ! current_user_can(‘manage_options’) ) { // ‘update_core’ may be more appropriate remove_filter( ‘update_footer’, ‘core_update_footer’ ); } } add_action( ‘admin_menu’, ‘my_footer_shh’ );

Showing User’s Post Counts by Custom Post Type in the Admin’s User List?

Here’s an expansion of Mike’s tutorial answer. I added links to the types listed so you can click on one and be taken right to a listing of all the posts in that type for that author, which required an additional variable for $counts and some extra output for $custom_column[] add_action(‘manage_users_columns’,’yoursite_manage_users_columns’); function yoursite_manage_users_columns($column_headers) { unset($column_headers[‘posts’]); … Read more

Find out which moderator approved comment?

To record the moderator that approves the comment: function wpse_comment_moderator_log( $comment ) { global $current_user; get_currentuserinfo(); update_comment_meta( $comment->comment_ID, ‘approved_by’, $current_user->user_login ); } add_action( ‘comment_unapproved_to_approved’, ‘wpse_comment_moderator_log’ ); To display it after the comment text: function wpse_display_moderator( $comment_text, $comment ) { $approved_by = get_comment_meta( $comment->comment_ID, ‘approved_by’, true ); if ( $approved_by ) { $comment_text .= ” – … Read more

Setting admin edit panels & metaboxes positions and visibility for ALL users and admins

You can remove the default meta boxes with remove_meta_box and re-add them in a different position with add_meta_box: add_action(‘do_meta_boxes’, ‘wpse33063_move_meta_box’); function wpse33063_move_meta_box(){ remove_meta_box( ‘postimagediv’, ‘post’, ‘side’ ); add_meta_box(‘postimagediv’, __(‘Featured Image’), ‘post_thumbnail_meta_box’, ‘post’, ‘normal’, ‘high’); } The answer above is from the following thread: How to change default position of WP meta boxes? UPDATE If the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)