If you enqueue your style sheet first you should be able to use wp_add_inline_style afterwards.
function custom_style() {
wp_enqueue_style('your_css', plugin_dir_url( __FILE__ ) . 'style/your_css.css' );
$bg_color = get_option('custom_color');
$custom_css = " body { background-color: {$bg_color}; }";
wp_add_inline_style( 'your_css', $custom_css );
}
This is not tested (just written from mind) and I have never used it in the admin section. Just test it with admin_enqueue_scripts.
Related Posts:
- How Restrict access to admin dashboard by specific static ip?
- Why isn’t admin_notices displaying my text? [Simple Plugin, Beginner]
- WordPress takes too much time (100 seconds) to load – Front end and back end
- WordPress on AWS with ELB
- How to make multiple admin pages for one plugin?
- How can i force wp-admin to use 2-column dashboard layout? [closed]
- WordPress fatal error from php protocol codes
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Calling PHP function with AJAX
- WordPress Plugin PHP Not Calling Function
- Is admin section completely customizable in terms of styling?
- Admin login substantially slower on production server
- Allow direct access to files/folders within WordPress to replace wp-admin
- PHP FATAL ERROR
- Adding a Taxonomy Filter to Admin List for a Custom Post Type?
- How to build an API as a plugin
- category_name not working (not showing up in sql query debug)
- How can I make my custom shortcode work in a Custom HTML Widget?
- Custom admin column disappearing when using Quick Edit [duplicate]
- Update Multiple Post Meta for the Same Post In One call?
- WordPress Hook that will run when media file deleted
- Post source link plugin – small modification
- Which hook callback has priority if both plugin and theme use the same hook?
- how to not show plugin in admin area
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Getting “Fatal error: Call to undefined function wp_cache_get() in option.php” after updating a cache plugin [closed]
- How can I make the “Preview Post” button save and preview in the same window?
- Escape special characters in image link
- Cannot run the code after I activate the plugin
- Displaying admin notice dynamically
- Weird problems after recovery from security breach
- Get total number of comment of the posts written by an author
- WordPress Ajax Callback
- printf – problem to understand code
- Auto delete WordPress users according to time
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- add_query_arg not working
- Theme my Login plugin, how to update fields
- How would I go about creating a user ranked post popularity page?
- WordPress: PHP code rendering in the wrong place
- New to wordpress, Question about editing PHP
- How to hide some section in WordPress under Post
- How to edit content before post update
- Polylang : Interverting languages after development [closed]
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- WordPress call_user_func_array() expects parameter 1 to be a valid callback, class
- Why is my custom post type not being activated on plug-in activation?
- What happens when WordPress memory limit is exceeded?
- iframe not showing in post (with “allow php in posts” plugin activated)
- how can I do something on new user registration?
- Any idea how to get something like this to work? [closed]
- wp_dequeue_script for a Plugin
- wp_enqueue_style on template_redirect level?
- Built a second plugin but it overwrote the first one
- WordPress: Add custom add_filter for custom functions
- getting notifications about updates only in the “core” page
- How to change layout of shop page in wordpress? [closed]
- preg_replace() No ending delimiter ‘.’ found [closed]
- Categories from front-end, checkbox selection doesn’t work
- Edit page header on a custom plugin
- Can you echo PHP code from a variable?
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- How can I adjust my function so the page editor still loads in the backend?
- Submitting form to PHP
- Looping the data from WordPress database using foreach
- Rename a folder via HTML POST request
- WordPress plugin blog creation
- Modifying server’s response to API endpoint
- Change Jobs for WordPress templates
- Defining constant in a plugin to use in another plugin
- Failed to load resource: the server responded with a status of 500 () post.php
- Custom SportsPress list
- Continous audio play in pages
- Adding link for logged in user? [closed]
- Create csv file in plugin
- How to copy data from user profile page (profile.php) to theme customizer
- wp-admin will not redirect to wp-login.php
- Changes required to make new plugin from existing
- Metabox Data not saving
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Xml output not places where i want
- Which filters or actions involve with index page for plugin?
- Including a PHP file via a function that is part of a plugin?
- Gutenberg: Dynamic Block – Show saved data in the editor
- How to fix ‘Call to undefined function do_settings()’ error?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Mixed content warning on doctype in admin
- Child Plugin Admin Panel
- Ajax in wordpress [duplicate]
- List all posts in a particular page [closed]
- Passing an input variable through a switch statement
- Function not being called on form submit, only blank admin-post.php page
- cURL External API request displays content above other content on page
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Posts in Admin only display 1 Post instead of all Post in admin area
- Creating a Table Row by Row
- Getting 504 Gateway Timeout Error on AWS Server! [closed]
- WordPress issue – data is not showing in wp-admin, but when searching through database, all the data is there
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files