WordPress后台双击评论内容可以编辑评论

今天在网站后台审核评论的时候,偶然发现了这个功能,双击要编辑的评论内容,即可进入评论编辑模式,很是快捷。更直观的体验可以点此:查看flash演示

如果你不喜欢此功能,可以在当前主题的functions.php中添加以下PHP代码:

<?php
 /*
 * Plugin Name: Remove Double-Click to Edit for Comments
 * Description: Disables the double-click to edit action for comments
 * Author: Pippin Williamson
 * Version: 1.0
 */
 class Remove_Double_Click_To_Edit {
 public function __construct() {
 add_action( 'admin_footer', array( $this, 'javascript' ) );
 }
 public function javascript() {
 global $pagenow;
 if( 'edit-comments.php' != $pagenow ) {
 return;
 }
 ?>
 <script>
 (function($){
 $('tr.comment').each(function() {
 $(this).find('a.vim-q').each(function() {
 $(this).removeClass('vim-q');
 });
 });
 }(jQuery));
 </script>
 <?php
 }
 }
 new Remove_Double_Click_To_Edit;
来自露兜博客