if (!current_user_can('administrator')) {
show_admin_bar(false);
}
function increase_search_results($query) {
if ($query->is_search) {
$query->set('posts_per_page', '50');
}
return $query;
}
add_filter('pre_get_posts', 'increase_search_results');
add_action('wp_logout','auto_redirect_after_logout');
function auto_redirect_after_logout(){
wp_redirect( home_url() );
exit();
}
if (!current_user_can('administrator')) {
add_filter('show_admin_bar', '__return_false');
}
function my_login_redirect($redirect_to, $request, $user) {
//Is it an admin? If so, let them go to default place
if (isset($user->roles) && is_array($user->roles) && in_array('administrator', $user->roles)) {
return $redirect_to;
} else {
return home_url('your-url'); // Change URL
}
}
add_filter('login_redirect', 'my_login_redirect', 10, 3);
function custom_excerpt_length( $length ) {
return 20; // Return 20 words
}
add_filter('excerpt_length', 'custom_excerpt_length');