Thanks to the help of two fellow members of this forum I have managed to get the snippet working.
Here I leave the solution for any future answer seeker who happens to stop by.
add_action( 'wp_head', function () {
//Get current user ID, if the user is logged in.
if ( is_user_logged_in() ) {
$user_id = get_current_user_id(); }
// Get the user object.
$user = get_userdata( $user_id );
// Get all the user roles for this user as an array.
$user_roles = $user->roles;
// Check if the specified role is present in the array.
if ( in_array( 'customer_2', $user_roles, true ) ) { ?>
<style>
.woofs-additional, .woofs-total {display: none!important;}
</style>
<?php
}
} );
Related Posts:
- wp_head() gives me some weird CSS
- Deregister CSS style link ‘open-sans-css’
- wp_head function causes 30px blank space [closed]
- Remove Genericons Helper CSS from twentyfourteen theme
- Display Something in the Header After All Styles are Loaded
- Remove CSS & JS from
- Wrong image path within inline styles in the head
- Where are the contents of WP_Head
- unable to override style block within wp_head()
- Column order manipulation using col-lg-push and col-lg-pull in Twitter Bootstrap 3
- What does !important mean in CSS?
- How to align a to the middle (horizontally/width) of the page [duplicate]
- Animate the overflow property
- Is there a color code for transparent in HTML?
- What does auto do in margin: 0 auto?
- CSS3 Transition not working
- CSS Invalid Property Value?
- CSS how to make an element fade in and then fade out?
- How to center vertically and horizontally a div using Bootstrap?
- How to word wrap text in HTML?
- Style disabled button with CSS
- Combine :after with :hover
- How to show tags in my tumblr theme?
- HTML span align center not working?
- Adding a blurred border in CSS
- Specify multiple attribute selectors in CSS
- How to make certain text not selectable with CSS
- How do I center an SVG in a div?
- How to expand textarea width to 100% of parent (or how to expand any HTML element to 100% of parent width)?
- Is it possible to enqueue a raw CSS string directly from within a template file?
- How to dequeue a stylesheet by src, not handle?
- WordPress CSS head info – contents, expansions?
- Gutenberg Block Editor Match Admin Styles & Frontend Styles
- The correct way to include JavaScript and CSS in my WordPress Themes
- Is it possible to change the path of a css file that is registered through wp_enqueue_style()?
- Styling Custom Meta Boxes?
- Customizing wordpress to match your site theme
- Is it better to put CSS in additional CSS or in Child theme styles.css [closed]
- Adding HTML to the Header, Screws up in IE7
- Efficient way to edit WordPress themes
- How To Load Different CSS Style, Based On Language When Using QtranslateX [closed]
- Where Do I Find The Astra Default Font Family That All Text Elements Are Inheriting From? [closed]
- Getting page output HTML without request (for CriticalCSS, PurgeCSS)
- How to organize priority of plugins CSS files?
- Responsive Images Warping
- Remove margin from CSS gradient color code
- Unable to remove space between header and slider section in wordpress website
- How do I apply/target CSS to a specific user role or roles?
- Why is this jquery / java script code not working in mobile / in devices?
- Seperate functions.php for part of site
- Internet Explorer ignore my css
- How can I remove the ::after CSS selector which is automaticaly appended to the_content()?
- Hover colour spreading out beyond submit button
- Some Text of website page on Iphone Safari become invisible
- post_class not working with css
- Adding CSS to Blog Posts?
- Where do I go to change the position of the style.css?
- Using PHP Increment and Conditional Statement to Alternate Loop Background
- wp_enqueue_media is not loading styles
- Remove a Style Tag from WP Theme
- Simple way to add custom class and ids to individual Gutenberg blocks
- child theme appears again when I put the header with parent name.
- Namespacing theme CSS
- cookie free subdomain and @font-face
- How to change the standard navigation menu color when using genesis [closed]
- How to add class to an html output element in tinyMCE paragraph drop down menu
- Add classes + taxonomy terms to wp_list_pages() output
- CSS isn’t rendered on a post but just posted as text [closed]
- How would I create the same popup in css and javascript as the one in contact button on the site https://www.sublimotionibiza.com/es/main.html [closed]
- How to use css only H2 Tag? Site is considering website title also H2 tag and changing its style as well
- How to edit CSS style sheet after migrating from local
- WordPress footer always at the bottom of the screen-page
- Dequeing Parent Fontawesome Deques Parent Styles
- WordPress childtheme not loading any CSS/SCSS
- Why can’t blocks be hidden with jQuery?
- CSS: Appearance/Customise display different to actual display
- Border around menu button [closed]
- Correct use of !important
- How to change hover link colour for blog post (body) text only
- Problems styling a Custom Link in a Menu
- Font .woff files loaded don’t correspond to the displayed styles [closed]
- Help locating old custom_css in PHP MyAdmin
- I would like to achieve a two column checkout page
- Twenty Fourteen: Shrinking header while scrolling down
- CSS ?ver=4.7.3 not found
- Custom CSS rules only apply to home page
- How to enqueue google fonts if we use directly in style.css
- Trouble with adding preloader to my home page index.html and index.js
- How to change in css with a custom theme?
- How to change menu hover color to white on my theme? [closed]
- How to make CSS load live based on options clicked in the theme customizer?
- How can a left and right margin be added to the admin bar without access to “…wp-includes/admin-bar.php”?
- Inserting a DIV Block Into a Listing of Excerpts?
- WordPress Custom Superfish CSS Problem [closed]
- Do you use css reset in your child theme [closed]
- Is it possible to make invisible a div only on certain pages using CSS?
- What CSS selectors to know for WordPress? [closed]
- How enqueue CSS out of theme folder?
- Styling not refreshing for old visitors on WordPress
- What is unsafe about this CSS?