AI Verified

Name

Custom Redirect Login - JetForm Builder

About

O código redireciona o administrador para uma URL e o subscriber para outra. Neste caso admin para 'dashboard/painel-admin' e subscriber para 'dashboard'

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

Altere as urls definidas em admin para 'dashboard/painel-admin' e subscriber para 'dashboard'

Codevault

code-carlaherrera

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Snippet Source:

https://carlaherrera.com.br/

History

Last modified:

14/05/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Custom Redirect Login - JetForm Builder

 
                    
1function custom_login_redirect( $user_login, $user ) {
2 if ( isset( $user->roles ) && is_array( $user->roles ) ) {
3 if ( in_array( 'administrator', $user->roles ) ) {
4 // Redirect admins to the admin dashboard
5 wp_redirect( '/dashboard/painel-admin/' );
6 exit;
7 } elseif ( in_array( 'subscriber', $user->roles ) ) {
8 // Redirect subscribers to the subscriber dashboard
9 wp_redirect( '/dashboard/' );
10 exit;
11 }
12 }
13}
14add_action( 'wp_login', 'custom_login_redirect', 10, 2 );

0

Related Snippets

Please see some snippets below related to this snippet..

WordPress Admin

AI Verified

0

Order archive posts by name

Added: 2 years ago

Last Updated: 1 year ago

By default the Elementor archive posts widget does not have a query setting so using this snippet orders the archive content by name.

WordPress Admin

AI Verified

0

Give editors access to manage options (to access some plugins)

Added: 1 year ago

Last Updated: 1 year ago

it give the editor role the manage_options capability in some cases it is necessary to access some plugins.

WordPress Admin

AI Verified

0

פונקציה שמוסיפה את הפריפיקס tel: לערך השדה ב ACF

Added: 2 months ago

Last Updated: 2 months ago

יצירת קישור לטלפון בתוסף ACF בוורדפרס ולהוסיף באופן אוטומטי את הפריפיקס "tel:" למספר הטלפון

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

Elementor

Unverified

0

Remove a opacidade do texto input no formulário do elementor

Added: 1 year ago

Last Updated: 1 year ago

Remove a opacidade do texto input no formulário do elementor

WordPress Admin

AI Verified

0

Custom Redirect Login - JetForm Builder

Added: 1 year ago

Last Updated: 1 year ago

O código redireciona o administrador para uma URL e o subscriber para outra. Neste caso admin para 'dashboard/painel-admin' e subscriber para 'dashboard'