在WordPress管理页面自定义错误信息

前端之家收集整理的这篇文章主要介绍了在WordPress管理页面自定义错误信息前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

wordpress管理页面自定义错误信息

这段代码可以在管理页面自定义一个错误信息,把他放在主题的functions.PHP中就可以实现该功能

add_action( 'admin_notices','custom_error_notice' );
function custom_error_notice(){
global $current_screen;
if ( $current_screen->parent_base == 'themes' )
echo '<div class="error"><p>Warning - If you modify template files this could cause problems with your website.</p></div>';
}

猜你在找的wordpress相关文章