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

Search posts by ID in admin

Not sure i understand why you’d want to query by ID, but that said it’s possible in a hacky kind of way(i like this method because it’s simple). add_action( ‘parse_request’, ‘idsearch’ ); function idsearch( $wp ) { global $pagenow; // If it’s not the post listing return if( ‘edit.php’ != $pagenow ) return; // If … Read more

How to Add a Third Level Sub Menu to the WordPress Admin Menu

No, it is not possible to create third level menu in admin panel. If you look at the definition of add_submenu_page, you need to mention the parent slug name. For eg: add_menu_page ( ‘Test Menu’, ‘Test Menu’, ‘read’, ‘testmainmenu’, ”, ” ); add_submenu_page ( ‘testmainmenu’, ‘Test Menu’, ‘Child1’, ‘read’, ‘child1’, ”); The first parameter of … Read more

if admin is logged in

current_user_can will accept a role name but, sadly, the behavior with roles is not entirely consistent. The following should work and is simpler than what you have, by a little bit. $current_user = wp_get_current_user(); if (user_can( $current_user, ‘administrator’ )) { // user is an admin }

Admin: very slow edit page caused by core meta query

If you want to test your custom SQL to see how it affects the loading time, you can try this query swapping: /** * Restrict the potential slow query in the meta_form() to the current post ID. * * @see http://wordpress.stackexchange.com/a/187712/26350 */ add_action( ‘add_meta_boxes_post’, function( $post ) { add_filter( ‘query’, function( $sql ) use ( … Read more

Changing the “Plugin Activated” Message Default

You can try this: is_admin() && add_filter( ‘gettext’, function( $translated_text, $untranslated_text, $domain ) { $old = array( “Plugin <strong>activated</strong>.”, “Selected plugins <strong>activated</strong>.” ); $new = “Captain: The Core is stable and the Plugin is <strong>activated</strong> at full Warp speed”; if ( in_array( $untranslated_text, $old, true ) ) $translated_text = $new; return $translated_text; } , 99, … Read more

Create tabs inside Plugins Admin Page [closed]

I advice you to read this topic: Here you can find complete guide making options page with tabbed content. Or you can just copy the html of the tabbed page that you’ve liked, and use it on your own options page. I made my options page with tabs too, but with api. Tabs and the … Read more