Skip to main content
Login Join
Snippet · PHP

Add Custom Admin Body Class in WordPress

Shared by Sumit Javia · May 23, 2026 · @admin_body_class

17 views
Back to Snippets

This snippet adds a custom CSS class (notranslate) to the WordPress admin body tag. It can be useful for preventing browser translation tools or applying custom admin-specific styling and functionality.

/**
 * Add a custom CSS class to the WordPress admin body element.
 *
 * This snippet appends the 'notranslate' class to the admin body tag
 * to help prevent browser translation tools from translating
 * the WordPress admin interface.
 *
 */
function sj_add_custom_admin_body_class( $classes ) {

    // Append custom admin body class.
    $classes .= ' notranslate';

    return $classes;
}

add_filter( 'admin_body_class', 'sj_add_custom_admin_body_class' );