Estimated Reading Time: 2 min
If you’re using the GeneratePress theme and want to ensure the premium elements section remains open in your WordPress admin panel, a small tweak to your functions.php file can do the trick!
By default, the GeneratePress Premium Elements section may collapse, requiring you to expand it every time. However, with the following snippet, you can force it to stay open:
How to Implement This Fix
- Log into your WordPress dashboard.
- Navigate to Appearance > Theme Editor (or use an FTP client).
- Open your functions.php file.
- Add the following code snippet at the bottom:
add_action( 'admin_head', function() {
echo '<style>#generate_premium_elements.closed .inside {display: block;}</style>';
} );
- Click Update File to save the changes.
How This Works
This code snippet hooks into admin_head
, which allows us to inject CSS into the WordPress admin panel. The added CSS ensures that the .inside
section of #generate_premium_elements
remains visible even if it was previously collapsed.
Final Thoughts
This is a simple but effective tweak to improve your workflow inside the WordPress admin panel. If you want to revert the change, just remove the snippet from your functions.php
file.

Update Improved Version ! 🚀
Your code snippet is using add_action( 'admin_head', function() {...} );
to inject a small CSS rule into the WordPress admin panel. However, if your goal is to ensure the #generate_premium_elements
section remains open in the WordPress admin panel, then your CSS is slightly incorrect.
🔹 Fix & Improved Version
Here’s an improved version of your code:
add_action( 'admin_head', function() {
?>
<style>
#generate_premium_elements.closed .inside {
display: block !important;
height: auto !important;
overflow: visible !important;
}
</style>
<?php
} );
🔹 Explanation & Fixes
✅ Added !important
to Ensure Priority
- WordPress admin styles might override your CSS. Using
!important
ensures it applies correctly.
✅ Ensured Visibility with height
and overflow
height: auto !important;
allows the content to expand naturally.overflow: visible !important;
ensures no hidden content.
✅ Maintains WordPress Standards
- Wrapped CSS inside a proper PHP function with
add_action('admin_head', function() { ... });
to keep it clean.
🎯 Result
This will force open the #generate_premium_elements
section in the WordPress admin panel, preventing it from being collapsed.
✅ Let me know in the comments if you need further modifications! 🚀🔥