I’ll post whole code which have to be in functions.php it’s legit WP valid code, how it should be done 🙂
This should work, of course you have to put your role name in switch.
UPDATED FOR PERFORMANCE:
add_action( 'show_user_profile', 'user_fields_for_admin', 10);
add_action( 'edit_user_profile', 'user_fields_for_admin', 10);
function user_fields_for_admin( $user ){
switch ($user->roles[0]) {
case 'SOME ROLE':
echo '<b>This is the role specific fields</b>';
echo 'fields....';
break;
case 'SOME ANOTHER ROLE':
echo '<b>This is the role specific fields</b>';
echo 'fields....';
break;
}
}
Related Posts:
- Create pages automatically if they don’t exist
- Editing Complex Pages in Visual Mode
- Change admin startpage to Pages-page?
- How to create virtual pages with information from user meta profile fields?
- What’s the most minimal way in which a page can be hooked into WP?
- Associate Page with User
- Static files or dynamic WP pages for “static content”?
- CMS: Making complex pages editable by the end user
- Remove specific page/post from feed
- Custom page template not working
- How to detect if is_404() or is_page() or etc…? [closed]
- Redirect page to default subpage
- How can I use “getarchives_where” to get monthly archives for static pages?
- Add a static page that links to homepage
- Create page template with some static contents
- Can I change the “Home” text in the menu?
- Get rid of “comment” field on non-blog pages [duplicate]
- How do you set the default page in WordPress?
- Pages that don’t look like blog posts?
- After creating a new page, filling the page with structure
- Use a custom page with dynamic content as a user profile page
- Problem with deleting a “Page”
- Create nonce in frontend page to edit profile
- How do I make just one of my pages a Blog Page?
- Standard way of creating profile pages with custom content for each user?
- pagination does not work with query_posts. Help! [duplicate]
- How to remove title (home) from static page skeleton template
- Multiple WordPress Pages
- How to create an user defined page?
- Load new Posts on Scroll on Page
- Default pages to be unpublished – possible?
- How to remove the trackback and pingback text on the bottom of my pages?
- How to display text of a page in home or custom page?
- Create a plugin to create a new page in wordpress for each time a record is added into the database
- User profile in front-end
- How to set post slug when using wp_insert_post();?
- What methods to use to create small, editable pieces of text for static pages?
- Hide page visual editor if certain template is selected?
- What is an alternative to get_page_by_title()?
- Get page id by title?
- How to embed page content in a blog post
- Notify admin when page is edited?
- foreach error on false boolean from get_terms
- How to get a feed for post type ‘page’?
- Multiple pages on a single page
- WordPress post/page pagination (page links) to go back to the first section
- Export only pages and posts with mysql dump
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- Backend option to include a javascript file on specific pages?
- Programmatically add a custom page/path/url/route to WordPress
- How to get the order attribute of a page
- Visiting Webpage ONLY after another page was visited. Possible?
- How do I pass data from page content to the underlying PHP template
- Display page contain in index.php file
- How to redirect login and register pages
- Why do pages in WordPress have a hierarchy but menu’s also have a hierarchy?
- Control Content On Non-Blog Pages
- Custom page template with entirely different design. Is it possible in?
- Create custom page and add it in nav menu by code
- How to control who can view certain pages in BuddyPress? [closed]
- How do I reclaim either deleted pages or their permalinks?
- How to remove only pages from Admin Bar?
- Phantom page can’t get rid of/can’t get at to change
- ‘x’ Converted to html code in example: 5×10
- Published pages missing
- How can I send an email when someone uses the HTML download Attribute?
- Later blog post pages give 404 error
- Different css file not working for the page template I created
- How to add custom meta box when you have a custom page template file
- How to change the order of the Front Page so it doesn’t appear first
- 404.php only works if I’m logged in. Everybody else redirects to wp-login.php – why?
- How to publish some default pages in Multisite creation?
- Using index.php as page template
- What is the best way to make a custom page from a plugin?
- What’s the section of code (or loop) which retrieves the Page title and description?
- How to backup just pages from my site, but not posts with other post_type values
- Template field missing in page attributes
- How to hide a page in wordpress made for menu
- How to change default home link title?
- Put page on Archived statut after end of publication date
- Recovering a page from the drafts
- Pulling images from the media folder category to display inside a page
- My Password Protected Pages Aren’t Working
- Display grandchild page content on parent page
- Converting HTML to WordPress theme: integrating pages function and using its text editor, conditional enqueuing
- Display custom_post_type with current taxonmy of a page
- Category Page Custom Layout [closed]
- How to copy specific page content and create child page?
- How to output different content of page on different places in my template
- WordPress slow pages/post, hangs and white text
- Previewing Draft shows white page, publishing works fine?
- Changing title bar in browser window of theme “Encounters Lite”
- Custom Filter using meta_value in wordpress admin list not working
- Dynamic content in pages
- Javascript will not run properly
- Website fully loads then immediately crashes in Internet Explorer [closed]
- How to display a page?
- custom post type single page template not working
- custom css in one page
- Why is a page shown with ‘hidden’ next to the name in the list of pages if the page is set to public?