The File Scanning feature automatically extracts CSS classes from your theme files, CSS files, JavaScript files, and any other files containing class definitions. This powerful tool helps you discover and use all available classes in your WordPress installation.
🎯 Overview
File Scanning provides:
- Automatic Discovery: Find classes in CSS files
- Background Processing: Non-blocking scans that won’t slow down your site
- Automatic Triggers: Scan when specific post types are saved
- Flexible Selection: Choose specific files or entire directories
- Real-time Updates: New classes immediately available in autocomplete
🏗️ How File Scanning Works
Supported File Types
The scanner can extract classes from:
- CSS Files:
.css– You can select each CSS file separately - PHP Files:
.phpfiles that contain CSS, in<style>blocks orwp_add_inline_style()strings (for example the WPCodeBox functionality plugin). PHP files without CSS are not listed. - Folder: You can select a folder and it will scan all CSS files inside that folder
Scanning Process
- File Selection: Choose files/folders to scan
- Background Processing: Scan runs asynchronously
- Class Extraction: Parse files for CSS class patterns
- Database Storage: Store found classes with “Scanned” type
- Autocomplete Update: Classes immediately available
🧩 WPCodeBox Snippets
If WPCodeBox 2 is installed, Plain Classes reads your snippets straight from the WPCodeBox database. It works with or without the WPCodeBox functionality plugin.
- Only enabled CSS, SCSS and LESS snippets are scanned (SCSS and LESS are read as compiled CSS).
- On the Scan Classes page, the Include WPCodeBox snippets option turns this on or off. It is on by default and shows how many snippets are scanned.
- With no files selected, the button reads Scan WPCodeBox Snippets, so you can scan only your snippets.
- When you save a snippet in WPCodeBox (Save button or Ctrl+S / Cmd+S), Plain Classes rescans automatically, so new classes are ready in the block editor right away.
- Changes made elsewhere (imports, WPCodeBox AI) are picked up the next time you open the block editor.
🚀 Manual Scanning
Accessing File Scanner
Navigate to Tools → Plain Classes Gutenberg → Scan Classes

Interface Overview
File Tree Explorer:
- Browse your WordPress installation
- Select individual files or entire folders
- Visual icons distinguish files from folders
- Real-time path selection
Selected Paths Panel:
- View currently selected scan targets
- Remove individual paths
- Clear all selections
Scan Controls:
- “Scan Selected Files” button
- Progress indicator during scanning
- Results summary after completion
Selecting Files for Scanning
Method 1: Individual Files
- Navigate through file tree
- Click on specific files to select
- File appears in “Selected Paths” list
- Repeat for multiple files
Method 2: Entire Folders
- Click on folder names in tree view
- Entire folder and subfolders selected
- Efficient for theme/plugin directories
- Can combine with individual files
Running Manual Scans
-
Select Target Files/Folders
- Use file tree to choose scan targets
- Verify selections in “Selected Paths” panel
-
Start Scanning
- Click “Scan Selected Files” button
- Progress bar shows scanning status
- Process runs in background
-
Review Results
- Scan completion message appears
- Number of new classes found
- Classes immediately available in autocomplete
🔄 Automatic Scanning
Post-Save Triggers
The plugin can automatically scan files when certain post types are saved:
Supported Save Methods:
- ✅ WordPress “Update” button
- ✅ Keyboard shortcuts (Ctrl+S/Cmd+S via Scripts Organizer)
- ✅ Saving a snippet in WPCodeBox (see WPCodeBox Snippets above)
Default Trigger:
- Post Type:
scorg(Scripts Organizer posts) - When: Every time post is saved
- What: Scans your selected files/folders
Intelligent Filtering
Valid Class Detection:
- Filters out CSS properties that aren’t classes
- Removes pseudo-selectors and media queries
- Excludes JavaScript variables that look like classes
- Validates class name format
Duplicate Prevention:
- Checks against existing classes before adding
- Merges results from multiple files
- Prevents redundant database entries
Integration Hooks
Before Scan:
add_action('pcguten_before_scan', function($file_paths) {
// Custom logic before scanning
});
After Scan:
add_action('pcguten_after_scan', function($found_classes, $file_paths) {
// Process results
});
Filter Classes:
add_filter('pcguten_scanned_classes', function($classes, $file_path) {
// Modify found classes before storage
return $classes;
}, 10, 2);