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?
- Add admin bar link to edit author
- Logout/login redirect CSS issue
- Modify CSS via Theme Control Panel
- TinyMCE custom stylesheets for different post types
- 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?
- 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
- Trigger a custom function when option are saved in admin area
- WordPress Menuing Question :focus
- 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
- header_image() with CSS
- 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?
- I can’t add CSS with functions.php
- 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
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Can we have conditional CSS styling?
- 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
- 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
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- Correct way of Enqueue self hosted fonts in sass project
- Using Switch Statement to Change Image According to Last Digit of Topic ID
- Help with is_page() and calling css for specific pages in a Child Theme
- Child theme style.css didn’t work properly but the Customize Additional CSS did [closed]
- How to automatically add custom classes to headings in content area
- Changing the color of post title [closed]
- Preventing PHP Execution in Parent Theme
- Random text changing to weird icons in both admin & front end
- Allow the access over wp-login.php
- Syling Custom Fields echo’s from from functions.php
- functions.php / replacing div’s with new ones?
- Screen Options WordPress WYSIWYG
- Making an under maintenance page (without using plugins)
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- Image width issue in IE [closed]
- How do I make my child theme’s CSS update when I save it?
- wp_head not injecting css