如何在 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>',
但这不行
我认为仅删除此代码是不够的!
现在我该怎么办?
最佳答案
<?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;
}
?>
插件信用转到 TechHacking.com
如果在任何情况下插件不起作用或功能不起作用,您也可以使用此方法,我在很多自定义工作中都使用了此方法,并且证明它非常有效,没有任何问题。
为此,请打开您的主题主 css(样式表)复制并粘贴以下代码
#commentform #url, #commentform #url +label {display:none;}
来源:http://www.shariff.org/remove-website-field-comment-form.html
关于php - 如何删除评论中的电子邮件和网站 ((Wordpress)),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7953160/