GithubHelp home page GithubHelp logo

haseemajaz / hide-wordpress-admin-help-and-screen-options Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 5 KB

This versatile piece of code allows you to customize the WordPress admin interface by hiding the Help tab and Screen Options tab based on user roles and preferences.

Home Page: https://haseemajaz.com

License: MIT License

code codesnippet codesnippets dashboard website website-design website-development websites wordpress wordpress-api

hide-wordpress-admin-help-and-screen-options's Introduction

Hide-WordPress-Admin-Help-and-Screen-Options

This versatile piece of code allows you to customize the WordPress admin interface by hiding the Help tab and Screen Options tab based on user roles and preferences.

What Does This Code Snippet Do?

The WordPress admin interface is incredibly flexible, but sometimes you may want to streamline it for certain users or to eliminate distractions. This code snippet provides two separate functionalities:

Hide the Help Tab: It allows you to hide the "Help" tab in the WordPress admin dashboard for specific user roles or globally. This can declutter the interface, making it more user-friendly for your team.

Hide the Screen Options Tab: It enables you to hide the "Screen Options" tab, which allows users to customize the display of dashboard elements. By hiding this tab, you can ensure a consistent and focused dashboard layout for your users.

How to Use This Code Snippet

If you want to customize the WordPress admin interface using this code snippet, follow these simple steps:

Access Your Theme's functions.php File:

Log in to your WordPress dashboard. Go to "Appearance" > "Theme Editor." Select your active theme. Add the Code Snippet to functions.php:

On the right side, find and click on the functions.php file. Scroll to the bottom of the file and paste the following code snippet:


function hide_help() {
    if (is_admin()) {
        echo '<style type="text/css">
                #contextual-help-link-wrap { display: none !important; }
              </style>';
    }
}
add_action('admin_head', 'hide_help');

This part of the code will hide the Help tab.

Save Changes:

Click the "Update File" button to save your changes. Customize Screen Options (Optional):

If you want to customize the Screen Options tab, you can paste the following code snippet below the previous one:

function wpb_remove_screen_options() { 
    if (!current_user_can('manage_options')) {
        return false;
    }
    return true; 
}
add_filter('screen_options_show_screen', 'wpb_remove_screen_options');

This part of the code allows you to hide the Screen Options tab for users who do not have the "manage_options" capability (typically administrators).

Save Changes Again:

Click the "Update File" button to save both code snippets.

Customization

You can customize this code snippet further by adjusting user roles or capabilities to control who sees the Help and Screen Options tabs. For instance, you can modify the current_user_can() function to match specific roles or capabilities.

Contributions and Issues

This open-source code snippet is hosted on GitHub to encourage collaboration and improvements from the community. If you have any ideas for enhancements or discover any issues, please feel free to open an issue on GitHub. We appreciate your involvement in making this code snippet even more useful.

License

This "Hide WordPress Admin Help and Screen Options" code snippet is distributed under the GNU General Public License v2.0. It's free to use, modify, and distribute according to the terms of the license.

Thank you for considering this code snippet for customizing your WordPress admin interface. We hope it helps you create a more focused and efficient workspace for your users. Enjoy your improved WordPress experience!

hide-wordpress-admin-help-and-screen-options's People

Contributors

haseemajaz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.