What do you consider to be the home page?
Do you want to change what is answering on the /
url on your website?
If so, I think that you can use the init
hook and use wp_redirect()
function to send your user wherever you want based on the result of wp_get_current_user()
result.
Something like that.
add_action('init', function () {
if ($user = wp_get_current_user()) {
if (in_array('my-custom-role', $user->roles)) {
wp_redirect('/my-custom-url');
}
}
});
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Seeking clarification on page request life-cycle
- Code in theme functions.php faster than with a plugin?
- Showing Co-Authors on post page
- Override the filter from plugin in child theme
- Custom Taxonomy Tag Search
- How to Display a Plugin function (content) on frontpage using index.php
- Display post lists in 2nd paragraph
- Redirect to another page using contact form 7? [closed]
- Shortcode Attributes to Return different $_POST
- Woocommerce singe product custom gallery output works just on the first slide
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- Removing the custom_image_header from wp_head
- How would I get the new plugin version on this function?
- Unpublished Pages Failing To Appear On Custom Path
- Submitting form to PHP
- How to wrap image tag into div for post only?
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- wp_enqueue_scripts not working in custom theme
- What is the correct way for a theme to support plugin UIs?
- Need to create a Theme demo site that features multiple themes
- How to call “page specific menu items” in template [closed]
- Why does including a file in theme’s functions.php not work?
- login to wordpress with Get variables instead of Post
- Should I use RIPS tool to test my themes and plugins?
- Add Top-Level Menu that opens URL
- wordpress custom login successful redirect hook
- WordPress ajax call for not logged in users, doesn’t work
- Display All Non-Used Plugins
- Having separate plugins and themes folder for multi-site setup
- Why are some of my thumbnails not being generated?
- Built in audio player?
- Add get_option to jquery
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Network: retrieve a list of latest posts
- How to add class in plugin only for network site?
- PHP Fatal error: Call to undefined function plugin_basename
- WooCommerce get_price returning wrong price when used via ajax
- Open Post Thumbnail in New Child Theme File in WordPress
- Missing Argument
- load_plugin_textdomain error
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Using a function to change favorites listing
- how to add a button next to the wordpress view button?
- How to create a code editor for my plugin .?
- WP Query. Is there a maximum size?
- Difference and examples of esc_attr__() and esc_attr_e()
- Great blogs site resources/tutorial for WordPress Developers? [closed]
- How to prevent additional code in functions.php to be removed once there is an update?
- How can I support plugins in a custom theme?
- Redeclare function after plugin activation
- How to translate wordpress error message
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- How can I use my custom wordpress theme on two websites? [closed]
- WordPress API functions not working at AJAX functions.php call
- Hardcode a form in Contact Form 7 [closed]
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- Override methods in Yoast SEO breadcrumb class
- More gentle way to hook WordPress custom url
- auto activate plugin when theme is active
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Xamp installed local wordpress not allowing to publish or install plugin
- How to convert Currency from USD to other IP Based currency in Php function
- Newbie problem with adding include wp_footer
- the_posts_pagination() not working if I add wp_head() to header.php
- FPDF for creating pdf diplomas
- Creating an array from form inputs before it is posted to the options database
- adding dynamic/multiple slug values in ‘option_none_value’
- How to assign a specific service to a specific provider based on location
- How to get checkbox by default true in metabox?
- Modify function output in a plugin
- Is admin section completely customizable in terms of styling?
- When the user entered an unauthorized url redirect to login page
- How to make the first letter of a post title uppercase, in a plugin?
- Show content from plugin on index
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Get plugin to background of page
- Code fails in plugin file but works in functions.php
- Conditional required fields for WordPress Contact Form 7
- WordPress plugin options need to delete after deactivate & uninstall
- WordPress function to add text
- Directory structure for plugin changes
- How to show post attachment image
- Doing action based on input from options menu
- How to generate a responsive output from plugin?
- How to work email subscribe in WordPress?
- Sync roles across several plugins
- Editing a theme
- How often should I execute add_filter and function declaration in Code Snippets?
- How to code a wordpress page properly? Dashboard or unique Theme files or alternative?
- how to make wordpress remember my choice
- Meta box not displaying on the plugin page
- How to change all the urls of the WordPress site?
- Getting error when accessing Customizer Page
- Event Made Easy – Block registration to two or more events that have the same category
- I want to allow certain file types on dokan upload files