Redirect Using Custom Code

To write your own custom redirect code, you should familiarize yourself with the login_redirect filter. This page will explain how the filter works, and there are a few examples of how to apply this knowledge in the comments.

Here’s a very simple example to get you started:

function custom_login_redirect() {

return 'home_url()';


add_filter('login_redirect', 'custom_login_redirect');

This code will cause all users to be redirected to the homepage when they log in to your site. That’s all it does! If you want, you can change “home_url()” to a URL of your choosing. For example, replacing ‘home_url()’ with ‘/blog’ will direct users to your site’s blog page.

ACF (3)
Admin Column (4)
Amps (9)
Breadcrumbs (2)
CSS (6)
Custom post types (4)
Custom Taxonomies (3)
Customizer (4)
Furniture (3)
Hooks & Filters (2)
Jquery (9)
LAMP (9)
Login (5)
Meta boxes (6)
Multisite (2)
My Code (1)
Open Graph Meta Tags (1)
Pedals (9)
Redirects (2)
SEO (4)
Theme Building (5)
Title Tags (2)
Tuners (3)
Turntables (2)
Typography (3)
Uncategorised (61)
User Roles & Capabilities (2)
White labeling (7)
Working with Images (11)
Working with videos (2)
WP Database (1)