The general advice given to users who want to make simple edits to a theme without losing them is to create a child theme. This involves creating a directory, CSS file, a functions.php file, and uploading them to the webserver via WordPress or FTP.
Users must also make sure the child theme references the parent theme correctly in order to establish the proper inheritance. This can be a complicated process for a lot of people but thanks to a new feature proposal for WordPress 4.7, the days of going through this process may soon be over.
The Benefits of Adding a CSS Editor to the Customizer
The proposal suggests adding a CSS editor to the customizer which offers a number of benefits. Users can live preview changes before they’re applied and see how they’ll appear on mobile devices. Instead of editing files directly, changes are stored in a Custom Post Type for each theme and override theme styles.
Related projects such as customize changesets (#30937) and revisions for customizer settings (#31089) will allow for future enhancements. Adding the editor will also lay the groundwork for possibly removing the Theme file editor from core at some point in the future.
Here’s an example of what the CSS editor looks like in action. Note the line numbers that can help with troubleshooting purposes.
The editor also displays error messages for common syntax errors. For example, a missing bracket. Adding the editor is only the beginning with revisions, syntax highlighting, and in-preview selector helpers, planned for future iterations.
Special Meeting Planned to Discuss Storage Issues
In today’s WordPress developer chat, attendees discussed the pros and cons of the editor and whether or not it’s ready to be merged into WordPress 4.7. A point of contention preventing a final decision is how data is stored.
Members of the Core and Customizer Component teams will discuss this particular issue in detail in a special meeting before making a final decision to merge it.
Testing and Feedback Needed
To test this feature, you’ll need to apply the patch via Trac or the Pull Request from GitHub as it won’t land in WordPress Trunk unless the proposal is approved. The team encourages you to add custom CSS in the customizer using a variety of themes and to share your experience and feedback in the comments.
A Use Perfectly Suited for the Customizer
While I have yet to test this feature myself, it seems like the perfect use case for the customizer. While some developers have expressed concerns with the proposed implementation, others are excited to see it land in core.
Removing the need to create a child theme for small or simple changes is a huge win for users. It’s also a major win for those who provide support. Instead of giving a customer complicated directions, it can be as simple as telling them to open the customizer, click on additional CSS, paste the snippet of code, and click the save button.
Or one could just use the “Simple Custom CSS” plugin.