首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >WordPress -从配置文件页面隐藏个人设置

WordPress -从配置文件页面隐藏个人设置
EN

Stack Overflow用户
提问于 2015-12-08 20:14:51
回答 1查看 3K关注 0票数 1

在配置文件页(用户可以编辑他的详细信息)有部分“个人选项”与“管理配色方案”等。

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

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

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-08 21:27:14

这将起到以下作用:

代码语言:javascript
复制
// 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)黑客.

代码语言:javascript
复制
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/

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34165178

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档