You should use the filter login_redirect instead of wp_login:
function role_user_redirect_login($redirect_to, $request, $user){
if(array_key_exists('user', $user->caps)){
return admin_url('edit.php?post_type=test', 'https');
}
return $redirect_to;
}
add_filter('login_redirect', 'role_user_redirect_login', 10, 3);
Related Posts:
- Why have on every line
- WordPress and event-driven programming – what is it about?
- Include a external PHP file into a WordPress Custom Template
- Remove option to allow trackbacks/pingbacks from post page options
- How to remove hardcoded characters from playlists?
- What would be a PHP command to erase all posts from category X from the last month?
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- Display a selected custom product option in WooCommerce cart
- Custom post type column which compares dates?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Walker class: Problems with understanding how walk() method can be called without error
- Change comments form title on a page by page basis
- Limit the Excerpt field in WP-Admin in words
- How to create different menu’s for not logged in visitors and for logged in members?
- Search and Replace in database: How to replace data in SQL dump file on Windows?
- Setting up the child theme so as to enable right-to-left WordPress?
- Custom Loop Pagination on WordPress
- delete an array element when its date expires
- Infinite-Scroll Plugin and Jetpack Infinite Scroll Plugin – Adding to “Thoughts” Theme
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- Customized title tag for each page in pagination?
- How to break down importing of feeds
- Wrap First Character after in a tag
- How do I implement a .diff changeset from core.trac.wordpress.org locally?
- Multiple choice in a custom taxonomy
- Random Default Avatar Function
- Change the site tagline (or similar) based on current page
- Customizer: Output default value in Customizer CSS
- How to add just one specific page to widget without plugin?
- create a select input with menus created on a custom options page
- Taxonomy linked to pages
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- WP dynamic featured image – Can’t get second featured image url
- Converting HTML Template to WordPress Theme
- Can I install/embed WordPress on a ‘single page’?
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- How to pick the default selected value in wordpress dropdown?
- Send an email to specific adress when button is clicked?
- WordPress admin pointers tour bug?
- custom url rewrite for wordpress
- How to get the value of input hidden html from text editor to custom page template?
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Custom posts in different columns style
- Need help enqueueing webfonts
- Custom Background by Page IDs
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Underscore – Self hosted fonts
- Hook called before text widget save
- customize wordpress database error page
- Echo title attribute php
- str_replace with the_content is not working
- Ajax search shows all results when user empties input?
- List post by title length
- Need help with pagination
- List of Events with Multiple Dates: Only NEXT Date
- Set cookie for visitor
- Display movies that apear this day next
- Editor capabilities – admin_init
- WP insert post Redirect after function has executed
- Array data not saving to specified sections. How to make seting independantly?
- How can I add diffrent editable text fields?
- Integrate otp in my custom singup form
- Hide A Class and Add Custom HTML Code Using WordPress
- Featured image in menu wordpres
- How do I know if the user is a customer?
- How to block specific user id in custom login form?
- I want to fusion the product columns in email table order
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Dynamic “home” image and URL based on current folder
- Need help transforming echo to return for use with shortcode
- Noob question: want to remove the “site identity” logo for specific part of website only
- Redirect after login depending on the URL
- Add custom attribute to product’s HTML to woocommerce cart page
- Autoloading Classes in Plugins
- Automatically refresh page if widget is added to page?
- Real time notification on user profile after new comment
- How to add text before posts
- Add two or multiple functions in WordPress Post or Page
- Show content by using tags
- WordPress error on my website
- Use custom get results query to show posts WordPress
- How can I show only if custom field has content [closed]
- media-uploader insert into post is not inserting
- Best way to define a database with product codes and back-end support?
- How to show all of aspecific post type that has taxonomy and a specific term
- wp_customize_image_control default value
- How to hide something from custom home page with php code?
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- How to add button to top of theme customizer?
- Display a list of users with avatar filterable with alphabets
- How can I add more code to this?
- How does one programmatically manage posts from a external php script?
- Edit the Publish Widget Options
- How to remove the intro animation which appears during the load up of some WordPress themes? [closed]
- New to WordPress & Freelancing [closed]
- How to change product title color in shop page if product has specific product tag (Woocommerce)?