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?
- Dropdown menu on custom page with product to choose number of products per page
- How to get current post user id
- Change wordpress current_time function to different timezone
- Events Made Easy Plugin – Duplicate Title Tags
- Inserting HTML tag with ACF into shortcode
- Different UI in WordPress
- Executing my function once on a specific time
- How to append to title via functions.php for auto-posting plugin [duplicate]
- What is the correct way to update both WP/plugins/themes without breaking the site?
- How to stop or remove an action being called inside a function of an extended class
- Missing Argument
- load_plugin_textdomain error
- Redux Framework has an embedded demo. Click here to activate the sample config file
- How to override a plugin function wrapped in a class?
- Bootstrap Drop Down menu is not working
- Not getting author rank when using return
- The problem with WordPress Importer
- Why does my functions.php cause white-screen and media-library issues?
- How to make a slideshow shortcode based on the WordPress gallery shortcode? [closed]
- wordpress plugin is not activating from widget
- how to give a user a role?
- Theme my Login plugin, how to update fields
- Edit Yoast SEO breadcrumbs output [closed]
- Adding Shortcode to Text Widget
- Date calculations from 2 custom fields
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- All of my custom posttypes are 404’ing
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Custom random quote widget breaks when used in multiple sidebars
- Using a function to change favorites listing
- How to debug error message: Cannot modify header information
- Using a post-signup hook to get user details
- How to enable specific plugin only based around shop manager role?
- How to change constants in WordPress wp-config.php programmatically?
- Restrict media upload size by format
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- How to display custom sidebar in wordpress 5.5.2
- wp_get_post_terms is difference obj model than the one in rest api response
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- how to add a button next to the wordpress view button?
- creating html reusable blocks via shortcodes
- get current date + 90 days and checking every day
- Adding a new field to the address field type in gravity forms
- Classified ad website : which solutions to use? [closed]
- Replacing a plugin function with a custom renamed function doesn’t work
- How to create an input field, and base the output on spreadsheet data? [closed]
- Facebook Messager Plugin
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Best place for short bio,image and button [closed]
- How to call WordPress function other files
- What are the specifics of WordPress development I need to know? [closed]
- All sites themes functions.php have been changed
- Customize permalink wordpress category id
- WordPress shows error related to allow_url_fopen
- Conditional attributes and logic per product category
- Disqus deleted comments are syncing with wordpress but active comments do not
- Admin style for just one plugin in dashboard
- How to create a code editor for my plugin .?
- How to show only next post pagination link using wp_link_pages()
- Finding the URL to be used to check if plugin is installed with a theme
- WP Query. Is there a maximum size?
- Js file is not adding using this code in functions.php
- How to remove custom post type and add category and post name
- wp_footer hook only working on homepage not in other pages
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Grab WordPress Salt Data From URL
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- WordPress get_avatar function not correct working
- WordPress metaboxes – textfield suggestion automatically populated
- bbPress plugin: forum lists not showing in correct order? [closed]
- Which file of wordpress manage plugins functionalities?
- How to create an option page for this simple plugin
- Difference and examples of esc_attr__() and esc_attr_e()
- How to set Noindex to all wordpress pages in a catergory?