php[wordpress]禁用wordpress评论(代码片段)

author author     2022-12-11     587

关键词:

<?php

// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() 
	$post_types = get_post_types();
	foreach ($post_types as $post_type) 
		if(post_type_supports($post_type, 'comments')) 
			remove_post_type_support($post_type, 'comments');
			remove_post_type_support($post_type, 'trackbacks');
		
	

add_action('admin_init', 'df_disable_comments_post_types_support');

// Close comments on the front-end
function df_disable_comments_status() 
	return false;

add_filter('comments_open', 'df_disable_comments_status', 20, 2);
add_filter('pings_open', 'df_disable_comments_status', 20, 2);

// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) 
	$comments = array();
	return $comments;

add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);

// Remove comments page in menu
function df_disable_comments_admin_menu() 
	remove_menu_page('edit-comments.php');

add_action('admin_menu', 'df_disable_comments_admin_menu');

// Redirect any user trying to access comments page
function df_disable_comments_admin_menu_redirect() 
	global $pagenow;
	if ($pagenow === 'edit-comments.php') 
		wp_redirect(admin_url()); exit;
	

add_action('admin_init', 'df_disable_comments_admin_menu_redirect');

// Remove comments metabox from dashboard
function df_disable_comments_dashboard() 
	remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');

add_action('admin_init', 'df_disable_comments_dashboard');

// Remove comments links from admin bar
function df_disable_comments_admin_bar() 
	if (is_admin_bar_showing()) 
		remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
	

add_action('init', 'df_disable_comments_admin_bar');

?>

php完全禁用wordpress评论(代码片段)

查看详情

php禁用wordpress管理栏(代码片段)

查看详情

php禁用wordpress插件更新(代码片段)

查看详情

php禁用wordpress更新#nag(代码片段)

查看详情

php禁用wordpress文件编辑器(代码片段)

查看详情

php禁用wordpress发布修订版(代码片段)

查看详情

php在wordpress中全局禁用注释(代码片段)

查看详情

php禁用wordpress文件编辑器(代码片段)

查看详情

php禁用wordpress中的自动更新(代码片段)

查看详情

Wordpress:禁用白屏死机,启用标准 PHP 错误

】Wordpress:禁用白屏死机,启用标准PHP错误【英文标题】:Wordpress:disablewhitescreenofdeath,enablestandardPHPerrors【发布时间】:2020-01-0112:50:46【问题描述】:有什么方法可以禁用白屏死机(“抱歉,我们遇到技术问题”的错误)并让它... 查看详情

php禁用所有用户的wordpress管理栏(代码片段)

查看详情

php完全禁用wordpress评论(前端和后端)(代码片段)

查看详情

使用 PHP 5.4 禁用 WordPress 3.7 中的严格标准错误

】使用PHP5.4禁用WordPress3.7中的严格标准错误【英文标题】:DisablingStrictStandardsErrorsinWordPress3.7withPHP5.4【发布时间】:2013-11-0323:15:57【问题描述】:在将计算机更新到OSX10.9后,我试图通过我的php.ini文件禁用WordPress3.7中的STRICT错误... 查看详情

php在wordpress中禁用默认仪表板小组件(代码片段)

查看详情

禁用wordpress文件编辑器。

Addthissnippetto`wp-config.php`toremovethefileeditorlinksfromtheWordPressadminmenus.Readmoreabout...[disablingtheWordPressfileeditor](http://www.orderofbusiness.net/blog/disable-wordpress-file-editor/)define('DISALLOW_FILE_EDIT',TRUE); 查看详情

禁用wordpress中的主题更改

add_action('admin_init','slt_lock_theme');functionslt_lock_theme()global$submenu,$userdata;get_currentuserinfo();if($userdata->ID!=1)unset($submenu['themes.php'][5]);unset($submenu['themes.php'][15]); 查看详情

php禁用除管理员以外的所有用户的wordpress管理栏(代码片段)

查看详情

apache_conf在某些wordpress目录中禁用php执行(代码片段)

查看详情