How to remove logout confirmation message in WordPress

Bypass wordpress are you sure you want to logout screen when logging out of an already logged out account.

/* bypass wordpress are you sure you want to logout screen when logging out of an already logged out account. */
function smart_logout() {
	if (!is_user_logged_in()) {
		$smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/';
		wp_safe_redirect( $smart_redirect_to );
		exit();
	} else {
		check_admin_referer('log-out');
		wp_logout();
		$smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/';
		wp_safe_redirect( $smart_redirect_to );
		exit();
	}
}
add_action ( 'login_form_logout' , 'smart_logout' );

How to Load jQuery from the Google CDN with wp_register_script

There are many reasons to use Google CDN when adding jQuery to the front end of your WordPress site. One of the these reasons is that many of your visitors may not need to download it at all. When your visitors browser sees a Google CDN hosted copy of jQuery and if available will load from their browser cache negating the need to download the file again. Adding this snippet to the functions.php of your wordpress theme will register and include jquery from the Google CDN.

You may want to take a look at Googles hosted libraries to see what else is available.

add_action( 'init', 'jquery_register' );
function jquery_register() {
if ( !is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', ( 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' ), false, null, true );
wp_enqueue_script( 'jquery' );
}
}

How to User controlled optional wordpress login redirect

Do you require a more complex way to redirect users around your website when they login. This is a great method to use if you want to give your subscribers the ability to choose the page they are redirected to. You could provide visitors the option to redirect directly to their profile page or a custom settings page for your wordpress site. Adding this snippet to the functions.php of your wordpress theme will add a select menu to the login screen that will allow your users to choose where they would like to be redirected.

user-controlled-optional-login-redirect-screenshot

<?php
// Fields for redirect
function custom_login_fields() {
?>
        <p>
                <label>
                        <strong>Choose your location: </strong>
                        <select name="login_location">
                                <option value="">Select …</option>
                                <option value="<?php bloginfo('url'); ?>#banking">Banking</option>
                                <option value="<?php bloginfo('url'); ?>#insurance">Insurance</option>
                                <option value="<?php echo get_permalink(2); ?>">Securities</option>
                        </select>
                </label>
        </p><br/>
<?php
}
// Redirect function
function location_redirect() {
        $location = $_POST['login_location'];
        wp_safe_redirect($location);
        exit();
}
// Add fields to the login form
add_action('login_form','custom_login_fields');
// Make sure the redirect happens only if your fields are submitted
if ( (isset($_GET['action']) && $_GET['action'] != 'logout') || (isset($_POST['login_location']) && !empty($_POST['login_location'])) )
        add_filter('login_redirect', 'location_redirect', 10, 3);
?>

Digital