-
-
Hello.
I have the following WP Hooks that I am trying to run:
/**
* remove admin bar for member registrants
*/
add_action(‘after_setup_theme’, ‘remove_admin_bar’);
function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {
show_admin_bar(false);
}
}
/**
* extend wp logged in cookie to one year
*/
add_filter( ‘auth_cookie_expiration’, ‘keep_me_logged_in_for_1_year’ );
function keep_me_logged_in_for_1_year( $expirein ) {
return 31556926; // 1 year in seconds
}
I have attempted to run this code by placing it in the following locations:
- /wp-content/themes/specular/functions.php
- /wp-content/themes/specular/includes/register/functions.php
- /wp-content/themes/specular/functions-specular.php
Unfortunately, the code is not being executed. Where can I place this code to make it execute?
-
Hello,
Thank you for contacting us.
The issue is not where you put the code, but the code itself. Please edit it to this:/** * remove admin bar for member registrants */ add_action('after_setup_theme', 'remove_admin_bar', 1); function remove_admin_bar() { if ( !current_user_can('administrator') && !is_admin() ) { show_admin_bar(false); } } /** * extend wp logged in cookie to one year */ add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year', 99); function keep_me_logged_in_for_1_year( $expirein ) { return 31556926; // 1 year in seconds }
And paste it in file functions.php.
Let us know how it will go.Best regards!
-
You must be logged in to reply to this topic.