在WordPress管理頁面自定義錯誤信息
來源:程序員人生 發布時間:2013-12-11 21:07:14 閱讀次數:3644次
在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>';
}