WordPress-从个人资料页面隐藏个人设置


WordPress - Hide personal settings from profile page

在配置文件页面(用户可以在其中编辑他的详细信息)中有一部分"个人选项"answers"管理员配色方案"等。

我知道如何用CSS/jQuery删除它。

如何使用hook/filter/php代码删除该部分?

谢谢。

这将完成任务:

// 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( '#<h3>Personal Options</h3>.+?/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' );

在这里找到:

https://wordpress.stackexchange.com/questions/49643/remove-personal-options-section-from-profile

更新

这里还有一个JS(确切地说是jQuery)破解。。。

function hide_personal_options(){
    echo "'n" . '<script type="text/javascript">jQuery(document).ready(function($) { $(''form#your-profile > h3:first'').hide(); $(''form#your-profile > table:first'').hide(); $(''form#your-profile'').show(); });</script>' . "'n";
}
add_action('admin_head','hide_personal_options');

在这里找到:

https://premium.wpmudev.org/blog/how-to-simplify-wordpress-profiles-by-removing-personal-options/