admin管理员组

文章数量:1295265

Guys how can I Enable widget accessibility mode as a default for all users, I thought about update_user_meta in wp_user-settings but I was not successful.

Greetings

Guys how can I Enable widget accessibility mode as a default for all users, I thought about update_user_meta in wp_user-settings but I was not successful.

Greetings

Share Improve this question asked Apr 15, 2021 at 12:59 InfoluInfolu 14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

All enabling Accessibility Mode does is add a class to the admin body. The styles and script behaviour change based on that class. So if you want to make accessibility mode the default, you can add that same class if the user hasn't set accessibility mode on or off:

add_filter( 
    'admin_body_class', 
    function( $classes ) {
        $widgets_access = get_user_setting( 'widgets_access' );

        if ( empty( $widgets_access ) ) {
            $classes = $classes . ' widgets_access';
        }

        return $classes;
    }
);

本文标签: functionsEnable accessibility mode in widget as default