2013-07-10 23 views
0

我已經使用wordpress構建了一個自定義主題,並且正在嘗試刪除評論表單中的「網站字段」。在Wordpress自定義中刪除網站表單

我已經嘗試在我的function.php中插入這段代碼,但它似乎沒有工作。

//REMOVE WEBSIE FORM IN COMMENTS 
function remove_comment_fields($fields) { 
    unset($fields['url']); 
    return $fields; 
} 
add_filter('comment_form_default_fields','remove_comment_fields'); 

回答

1

我設法解決我的問題與本網站的幫助。

http://gerardmcgarry.com/blog/wordpress-how-remove-website-url-field-comment-form

顯然,我是缺少的comments.php列入主題。所以我所做的是複製位於wp-includes/theme-compat中的comments.php,然後將其粘貼到我自己的自定義主題中。

然後我擦除/刪除它。

<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" /> 
<label for="url"><small><?php _e('Website'); ?></small></label></p> 
0

浦牛逼了一個在你的主題的functions.php文件,它應該工作

add_filter('comment_form_default_fields', 'url_filtered'); 
function url_filtered($fields) 
{ 
    if(isset($fields['url'])) 
    unset($fields['url']); 
    return $fields; 
} 
+0

仍然一樣。我正在測試本地主機上的wordpress網站(XAMPP)。我一直在Google上搜索我的問題,所有結果都給出了完全相同的答案,並且一直爲其他人工作。然而,當嘗試在function.php中插入代碼它似乎並沒有工作 – clestcruz

+0

Nevermind我設法解決我的問題。只需谷歌更深:) – clestcruz

相關問題