You should be able to simply check the capabilities of the currently logged in user. If they’re an administrator the following example should do what you want it to. Just add this into your theme’s functions.php file.
Please note this code is untested, but it should get you where you want to be. If the level_10 capability doesn’t work you can check out the documentation for other user levels and capabilities here.
add_action( 'wp_enqueue_scripts', 'admin_only_stylesheet' );
function admin_only_stylesheet() {
if ( current_user_can('level_10') {
wp_register_style( 'admin-only-style', get_template_directory_uri() . '/css/admin-frontend-style.css', array(), '12345678', 'all' );
wp_enqueue_style( 'admin-only-style' );
}
}
Related Posts:
- How do I get the current edit page ID in the admin?
- How to load scripts/styles specific for a page
- functions.php inject inline css
- Modify Admin Bar Link
- How to remove row-actions from pages table?
- Is it possible to remove the main rich Text box editor?
- How do I create a new WP admin color scheme?
- Add admin bar link to edit author
- Logout/login redirect CSS issue
- Modify CSS via Theme Control Panel
- Add attribute to link tag that’s generated through wp_register_style?
- TinyMCE custom stylesheets for different post types
- Replacing select2 in admin backend for all selects
- echo or print_r in an admin function
- Can I remove the Rich Text box editor for a specific post?
- Remove “says” from comments
- How to add CSS style sheet dynamically in wordpress
- Simple/basic use of get_current_screen
- Custom colors for post rows based on post meta value
- Is it possible to be more page/post specific with admin_enqueue_script?
- Child Theme Not Overriding Parent Theme
- CSS stylesheet not loading
- Enqueue styles after a plugin
- How to add a column to the Trash page?
- How to add background image control to page admin controls?
- How to test for Super Admin
- Add class or ID to any WordPress function
- How to select a page within admin?
- Change Admin Bar “Visit Site” URL
- Register and enqueue style.css custom theme
- Multiple CSS body classes to specific page I.D.’s – is this possible?
- Enqueue Style Only On Certain Pages Not Working
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Child Theme files – what is needed?
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Stuck on maintenance mode
- Hard-coding custom menu elements for menu manager
- How to make custom column Admin>Users sortable?
- Trigger a custom function when option are saved in admin area
- WordPress Menuing Question :focus
- Move ‘current-menu-item’ class on #adminmenu li from Posts to Pages for Taxonomy Edit Screen
- change the url paths in the stylesheet dynamically
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Change CSS for logged in users
- How to stop wordpress from injecting hard-coded style into image attachments with captions
- different style sheet for just one page template
- Custom styles.css sheet for visual editor
- Is my code correct to enqueue CSS on a specific page?
- header_image() with CSS
- Not all CSS elements transferring via parent to child?
- Split Media Queries in different files!
- Some questions about how proper add 2 CSS file in a WordPress theme?
- problem loading stylesheets to wp_head dynamically
- How to insert class in each list of categories?
- Parent theme styles overriding child theme CSS [closed]
- I can’t add CSS with functions.php
- Theme JS is available but theme CSS isn’t
- Logout Redirect and also WP-login.php Redirect
- Proper Way to Load stylesheet on Condition
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- Default Nav Highlight
- what is best way to keep track of changes made in wordpress website? [closed]
- WordPress wraps span tags into p tags
- Custom styles in Tiny MCE with an external CSS file
- why can’t i add front.css to my frontpage.php
- WordPress website keeps loading the maintenance page
- get_template_directory_uri() links to child theme not parent
- remove/hide wp-editor
- Getting out side of wp root folder from function.php using absolute path
- Page Template Won’t Load Correct CSS File
- current_page_item is missing inside wp_nav_menu
- Creating a custom wordpress widget and stopping js from running twice(once in active widget once in widget selector)?
- define css class in functions.php
- Removing WPML Items From the WordPress Admin Bar
- Completely Disable WordPress RSS Feeds
- Show metadata in users.php – wordpress
- Advanced method to control cache of enqueued style/script
- How to display my comment count in the wordpress admin bar?
- Combine page types and Custom Taxonomy in a functions.php command
- Can’t load assets
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Can we have conditional CSS styling?
- CSS style and app.js not loading
- Post content overflows on my mobile phone
- Stylesheet does not load despite functions.php
- Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
- How do I make a custom “Read More Blogs” button for my blog page
- function class doesnt work
- Help using ShortCodes to style whole chunks of the post
- Setting Up Child Theme To Take Priority
- how to remove a tag in the_category function
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- CSS disabled after getting rid of emoji
- How to add styles in existing function?
- Woocommerce – Switching Price for Category
- Adding a class to the body of an inactive site using multisite
- Conditionally apply css for a specific template part
- Add custom css to specific user
- How to sort a non-meta field in the User Admin Panel?