Developers

Disable WP Ghost for User Roles

Our plugin is designed to provide users with the highest level of security and customization. One unique feature is the ability to whitelist specific IP addresses, which allows users to grant access to certain users while blocking others.

This can be particularly useful for businesses or organizations that want to grant access to employees or trusted partners while blocking access to unauthorized users.

If you want to deactivate the WP Ghost plugin for logged users with specific roles, you can add this code to the functions.php file of the theme:

add_action('template_redirect','hidePathsByUserRole');

function hidePathsByUserRole(){

    if (function_exists('wp_get_current_user')) {
        $user = wp_get_current_user();
        $allowed_roles = array(
            'administrator',
            'editor', 
            'author'
        );

        if( isset($user->roles) && is_array($user->roles) && array_intersect($allowed_roles, $user->roles ) ) {
            add_filter('hmwp_process_paths', '__return_false');
            add_filter('hmwp_process_buffer', '__return_false');
            add_filter('hmwp_process_hide_disable', '__return_false');
            add_filter('hmwp_process_find_replace', '__return_false');
        }
    }
}

The above code will disable WP Ghost for administrators, editors, and authors. You can add new roles or remove roles from the code.

John Darrel

Change Database Prefix in WordPress

Because hackers often use bots to search for security flaws in your website, it is…

12 months

Customize WordPress Uploads Directory

The easiest way to change the default media uploads path is to use the WP…

12 months

WP Ghost and WP Rocket Cache

To hide all CSS and JS you need to follow the steps to Combine the…

12 months

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

12 months

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

12 months

Setting up Two-Factor Authentication (2FA) for WordPress Using Mobile Apps

When you enable two-factor authentication (2FA) for your WordPress website, it adds an extra layer…

12 months