Remove Personal Options section only from subscribers profile

Question

I’ve seen there are already similar questions but my specific purpose is deleting/hiding personal options from ONLY subscribers’ profiles, so the action is defined towards a SPECIFIC ROLE

This is a generic function I found here, I suppose it works for ALL THE ROLES

// removes the `profile.php` admin color scheme options

remove_action( ‘admin_color_scheme_picker’, ‘admin_color_scheme_picker’ );

if ( ! function_exists( ‘cor_remove_personal_options’ ) ) {
/**

  • Removes the leftover ‘Visual Editor’, ‘Keyboard Shortcuts’ and ‘Toolbar’ options.
    */
    function cor_remove_personal_options( $subject ) {
    $subject = preg_replace( ‘#

    Personal Options

    .+?/table>#s’, ”, $subject, 1 );
    return $subject;
    }

function cor_profile_subject_start() {
ob_start( ‘cor_remove_personal_options’ );
}

function cor_profile_subject_end() {
ob_end_flush();
}
}
add_action( ‘admin_head-profile.php’, ‘cor_profile_subject_start’ );
add_action( ‘admin_footer-profile.php’, ‘cor_profile_subject_end’ );

0
Andrea Sacconi 2 months 2023-04-10T05:48:03-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse