Lets any Administrator simplify the WordPress Admin interface, on a per-user basis, by turning specific menu/submenu sections off.
Lets any Administrator simplify the WordPress Admin interface, on a per-user basis. Hide any specific menu or submenu (including in the admin bar) or hide the admin bar entirely.
- PHP 7.4 or higher
- Composer (for managing PHP dependencies)
- Node.js 18 or higher and npm (for building JavaScript assets)
- Clone the repository
- Run
composer installto install PHP dependencies - Run
npm installto install JavaScript dependencies - Run
npm run buildto build the React application
This plugin uses PHPStan for static analysis to ensure code quality and type safety.
To run PHPStan:
composer install # first time only
npm run phpstanOr directly with PHP:
php vendor/bin/phpstan analyseThe project is configured to run PHPStan at level 3 for improved reliability and maintainability.
Run PHP unit tests:
npm run test:phpThis plugin uses Playwright for automated visual regression testing to catch unintended visual changes during development.
Visual differences can negatively impact user experience. Automated visual regression testing helps identify these differences early by:
- Capturing screenshots of UI components
- Comparing them to baseline images
- Detecting unintended layout changes, CSS issues, and responsive design regressions
- Providing detailed reports showing exactly what changed
- Node.js 18 or higher
- Playwright browsers installed (Chromium by default)
-
Install dependencies:
npm install
-
Install Playwright browsers:
npx playwright install --with-deps chromium
-
Build the application:
npm run build
# Run all visual tests
npm run test:visual
# Run tests in UI mode (interactive)
npm run test:visual:ui
# Update baseline snapshots after intentional UI changes
npm run test:visual:updateVisual regression tests:
- Start a local web server serving the built application
- Navigate to test pages using a headless browser
- Capture screenshots of UI components
- Compare screenshots to baseline images stored in
tests/visual/app.spec.js-snapshots/ - Report any differences as test failures
When tests fail, Playwright generates detailed reports showing:
- What changed visually
- Side-by-side comparison of expected vs actual
- Highlighted differences
The visual tests cover:
- Initial state: App before user selection
- User selector: Dropdown component
- Menu interface: Full menu system with user selected
- Menu list: Toggle functionality and menu items
- Admin bar options: Toggle and menu controls
- Button components: Save and reset buttons
- Checkbox states: Checked/unchecked menu items
- Expandable submenus: Collapsed and expanded states
- Responsive layouts: Tablet (768px) and mobile (375px) views
When you make intentional UI changes:
-
Update the baseline snapshots:
npm run test:visual:update
-
Review the changes in
tests/visual/app.spec.js-snapshots/to ensure they match your intended changes -
Commit the updated snapshots with your code changes
Visual regression tests run automatically on GitHub Actions for:
- All pull requests
- Pushes to main/master branches
The workflow:
- Checks out the code
- Installs dependencies
- Builds the application
- Runs visual tests
- Uploads test reports and snapshots as artifacts (available for 30 days)
See .github/workflows/visual-regression.yml for the full configuration.
Tests fail after updating dependencies:
- Run
npm run test:visual:updateto regenerate baselines
Tests fail on CI but pass locally:
- Snapshots are platform-specific
- Ensure you're running tests in the same environment (Linux in CI)
- Font rendering may differ between platforms
Need to see what failed:
- Check the Playwright HTML report in CI artifacts
- Run
npm run test:visual:uilocally for interactive debugging
MIT License - see LICENSE file for details.