alexanderdejong.com

Wordpress Developer

  • Home
  • Blog
  • Projects
  • Contact
You are here: Home / Archives for wp admin bar

How to redirect a user during logout with WordPress

Posted on May 7, 2015 Leave a Comment

I found a handy redirect function which I would like to share with you all!

If you want a user to visit the the frontpage during logout, place this into your functions.php in your current theme directory:

add_action('wp_logout','go_home');
function go_home(){
  wp_redirect( home_url() );
  exit();
}

A neat trick, if you have php version above 5.3 then you can write an anonymous function which is more compact:

add_action('wp_logout',create_function('','wp_redirect(home_url());exit();'));

Filed Under: Wordpress, WP Tutorials Tagged With: login logout wordpress, login/logout, logout wordpress, peters login redirect, wp admin bar, wp_logout, wp-login php

How to Hide the WP Admin Bar

Posted on March 30, 2015 Leave a Comment

The WP Admin bar that WordPress automatically adds to your website when you are logged in can be seriously annoying (especially while you are designing away at your client’s website).

admin-bar

This bar can be frustrating because it can slightly throw off your design and you don’t really need it for anything. Here’s a snippet of code which will prevent that toolbar from displaying, just add it to your functions.php file or a plugin:

Hide the WP Admin Bar with the following php code

add_filter('show_admin_bar', '__return_false');

With this quick hack you don’t need change any CSS and your layout will look as it should. The filtering/hook system is really useful!

Filed Under: WP Tutorials Tagged With: wp admin bar

Recent Posts

  • Migrating a WordPress Website Manually with Phpmyadmin, Search and Replace, DigitalOcean and Runcloud
  • How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • How to Install Roots Bedrock on a Digital Ocean Droplet running on Serverpilot via SSH
  • Linux SSH Useful Server Commands to Remember: Grep, Permissions and more.
  • How to Install Roots Sage 8.5.1 on a Digital Ocean Droplet running on Serverpilot via SSH

Find more content

Affiliate links
  • cheap shared hosting
  • low priced virtual servers only 5$
Affiliates
  • If someone buys a product then I get a commission.
  • You pay the same price using my affiliate links.
  • I can spend more time making newsletters and tutorials.
  • Thanks for visiting!

Connect with me

Recent Comments

  • Pedro Gómez on Migrating a WordPress Website Manually with Phpmyadmin, Search and Replace, DigitalOcean and Runcloud
  • Tim Delmeire on How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • Jaehyuk J Yang on How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • Alexander de Jong on A guide on customising the membership experience with Theme my Login (TML)
  • Judit Sarkany on A guide on customising the membership experience with Theme my Login (TML)

Recent Posts

  • Migrating a WordPress Website Manually with Phpmyadmin, Search and Replace, DigitalOcean and Runcloud
  • How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • How to Install Roots Bedrock on a Digital Ocean Droplet running on Serverpilot via SSH
  • Linux SSH Useful Server Commands to Remember: Grep, Permissions and more.
  • How to Install Roots Sage 8.5.1 on a Digital Ocean Droplet running on Serverpilot via SSH

Copyright © 2014 | Alexander de Jong | About | Contact | Privacy | Sitemap