Skip to content

Conversation

@GaryJones
Copy link
Contributor

Summary

  • Implements is_post_management_page() method to properly scope module asset loading
  • Module CSS/JS now only loads on post management pages (post.php, post-new.php, edit.php) instead of every admin page
  • Optionally validates the current post type is supported by the module before loading assets

Background

The old is_whitelisted_functional_view() method always returned true with a @todo comment, meaning module assets loaded on every admin page unnecessarily. This caused wasteful resource loading on pages like the dashboard, plugins page, and settings pages where Edit Flow functionality isn't needed.

This takes the simpler "module-by-module" approach suggested in the comments of the previously closed #487, rather than attempting a global change that could break functionality.

Test plan

  • Verify assets load on post.php, post-new.php, edit.php
  • Verify assets don't load on dashboard, plugins page, options page, users page
  • Verify module-specific post type checking works (assets don't load for unsupported CPTs)
  • All 10 new integration tests pass

Closes #351

🤖 Generated with Claude Code

Module assets (CSS/JS) were loading on every admin page because
is_whitelisted_functional_view() always returned true. This was
wasteful and caused unnecessary resource loading.

Implement is_post_management_page() to properly check if we're on a
post management page (post.php, post-new.php, edit.php) before loading
module assets. Optionally validates the current post type is supported
by the module.

Closes #351

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@GaryJones GaryJones requested a review from a team as a code owner December 22, 2025 16:07
@GaryJones GaryJones self-assigned this Dec 22, 2025
@GaryJones GaryJones added this to the Next (minor) milestone Dec 22, 2025
@GaryJones GaryJones merged commit ad3d608 into develop Dec 22, 2025
12 checks passed
@GaryJones GaryJones deleted the fix/351-scope-module-assets branch December 22, 2025 16:20
@GaryJones GaryJones mentioned this pull request Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope loading of module styles and scripts

2 participants