如何删除评论中的电子邮件和网站((Wordpress))

Kin*_*ohi 2 php wordpress comments

如何删除Wordpress中的回复中的电子邮件和网站部分?像这样:http://sceper.eu/2011/10/manson-family-blood-on-the-wall-2011-cr.html 只看到Name (leave blank for Anonymous)留下回复

我使用wordpress 3.2.1并使用默认的Wordpress注释

((public_html/wp-includes/comment.php

public_html/wp-includes/comment-template.php))

我从omment-template.php中删除了这段代码

'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
                    '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
        'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
                    '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
Run Code Online (Sandbox Code Playgroud)

但这不是工作,我认为删除只有这个代码是不够的!

现在我该怎么办?

Kin*_*ohi 10

  1. 使用Windows中的记事本应用程序创建此插件并记住使用.php扩展名保存文件例如:removeurl.php

  2. 将以下代码复制并粘贴到步骤1中创建的文件中

    <?php
    /*
    Plugin Name: Remove Website Field
    Description: Removes the website field from the comments form
    */
    add_filter('comment_form_default_fields', 'url_filtered');
    function url_filtered($fields)
    {
      if(isset($fields['url']))
       unset($fields['url']);
      return $fields;
    }
    
    ?>
    
    Run Code Online (Sandbox Code Playgroud)

插件信用转到TechHacking.com

  1. 保存更改并通过FTP或通过Web主机文件管理器将其上传到/ wp-content/plugins /目录

  2. 在wordpress管理区域中输入插件菜单选项并激活插件.通过这个简单的黑客攻击,您将从评论表单中删除网站字段.

如果在任何情况下插件都不起作用或者函数不起作用你也可以使用这个方法,我在很多自定义工作中都使用了这个方法,并证明它非常有效,没有任何问题.为此,请打开主题主css(样式表)复制并粘贴下面的代码

#commentform #url, #commentform #url +label {display:none;}
Run Code Online (Sandbox Code Playgroud)

来源:http://www.shariff.org/remove-website-field-comment-form.html