function redirect_user() {
if ( is_user_logged_in() ) {
wp_redirect( 'http://yoursite.com/page/' );
exit;
}
}
add_action( 'init', 'redirect_user' );
This will redirect the user to the page of your choice if they are logged in. It might be necessary to add a conditional that checks to make sure the user isn’t already on that page, to avoid a continuous redirect loop.
Related Posts:
- wp_redirect on base wp-admin and login
- Force HTTPS 301 redirect with hook
- How to redirect home page to another page after login for all user?
- Detect if requested page is PWA on server side
- Difference Between Filter and Action Hooks?
- Which hook should be used to add an action containing a redirect?
- add_action hook for completely new post?
- WordPress Hook for user register
- How to check username/password without signing in the user
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- custom XMLRPC method plus authentication of user & WooCommerce order
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- Log in from one wordpress website to another wordpress website
- What’s the earliest point I can get the queried object ID?
- How do I Make a Theme “plugin-ready”?
- WordPress REST API call generates nonce twice on every call
- WordPress scheduled task is called but not executed
- How to modify post content before writing to database?
- WordPress custom authentication implementation
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Front-End Form Submission in Shortcode
- How to check if certain plugin exists and in expected version
- Plugin development, hooks, generate content
- Is it possible to create an action hook using do_action() within add_action()?
- Hook event for upload image in the menu
- Help with callback using do_action_ref_array
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- Best Practices for Creating and Handling Forms with Plugins?
- Is there a better way to implement responsive images than what WordPress uses by default?
- Modifying values with add_action to be sent to db
- Woocommerce – Hide a Column in Cart Table
- Configuring WordPress Auth Cookie Expiration
- Hook to get image filename when it is uploaded
- How to display a message about updates in the plugin list
- How to get the ID of the currently logged in user?
- How to delete an user including data from custom database tables
- Should action callbacks start with a verb?
- Why is my javascript not invoked in my hooks except wp_head?
- Namespaced action and filter tags
- What filter should I use to insert a button inside on Media>Add New
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- How to use a hook to override an update_post_meta call in a plugin?
- External Authentication, session_tokens not destroyed on logout
- Trying to understand order and frequency of action hooks firing
- correct way to call javascript into hook function
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- Send push when new post is published in a certain category
- Translation per IP location [closed]
- template_redirect or admin-ajax.php?
- WordPress custom taxonomy check box to dropdown
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- How to set a cookie for logged in users to md5($user->ID . “my_secret”)?
- Plugin uninstall function is not working
- Bug: Post needs to be updated twice when adding action for save_post hook
- Remove an action by extending class and replacing it
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- Bind a function with its own argument to show something dynamically after every content
- Why enqueue styles on hook?
- What’s the hook for filtering every texts of site?
- Hook add_attachment error
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Update variable value via add_filter
- Redirect in WordPress plugin
- hook update_option/updated_option empty $old_value and $value
- Secruity Questions on a timer
- Hide one specific woocoomerce product
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Restrict certain actions to plugin-specific admin menu pages only
- How to enhance a self developed plugin by its own plugin architecture
- How to update global variables in plugin activation callback?
- `registration_errors` filter doesn’t seem to be called
- How to grab data after wp user search is complete
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- get_queried_object_id combined with wp_redirect gets wrong id
- Hook for validating and rejecting frontend image upload
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Nested Hooks with do_action for performance reasons – safe/necessary?
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- OOP development and hooks
- remove different admin menu for specific users
- redirect_to how to make it simply work with get parameter or similar?
- Add_action not calling callback function
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- add_option_{$option} action hook not being called
- plugin modal/popup integration best practice
- Function not working on any file other than the main plugin file
- Multi hook deploiement
- woocommerce single product page hook not working
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- What is the use of wp_schedule_event hook?
- Get user logged in status from within a plugin. $current_user not defined
- Insert plugin html content to a specific spot in the frontpage
- Send Webhook when post-status is publish or trash
- Using “add_image_size” to register custom image sizes inside plugins not working
- get_term_by() returning null on plugin
- Ninja Forms: Front-End Forms, Post ID?
- Execute callback after REST API request completes + Response is sent