How about working with a team that puts the worries of the virtual environment aside and makes this burden more attractive to you with its wide range of services?
Contact Now: +90 850 305 25 95
E-mail:info@margarit.com.tr
Address: İvoksan, Neva Home Offices
1455 Street, 22/41 Yenimahalle / Ankara

Blocking WordPress Backend and Top Bar Access

margarit-web-reklam-bilisim-2020

To prevent unauthorized users from accessing the WordPress backplane:

wpse_11244_restrict_admin() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( __('You are not allowed to access this part of the site') ); } } add_action( 'admin_init', 'wpse_11244_restrict_admin', 1 );

To allow an unwanted user accessing the WordPress backplane to access the homepage:

function wpse_11244_restrict_admin() { if ( ! current_user_can( 'manage_options' ) && $_SERVER['PHP_SELF'] != '/wp-ajax./phpurl1; { } } add_action( 'admin_init', 'wpse_11244_restrict_admin', 1 );

To block the appearance of the WordPress admin top bar and menu:

<?php show_admin_bar(false); ?>

Just add it to your theme's .functions.php file.

As a last alternative, if you want the admin bar to be visible only to administrators and closed to all other roles:

add_action('after_setup_theme', 'remove_admin_bar');function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin() {bar(show)) } }

Just add the codes to your theme's .functions.php file.

No Comments
Post a comment

en_USEnglish