Skip to content

Only output sourceURL if SCRIPT_DEBUG enabled.#10984

Open
peterwilsoncc wants to merge 1 commit intoWordPress:trunkfrom
peterwilsoncc:fix/64369-only-show-sourceurl-for-script-debug
Open

Only output sourceURL if SCRIPT_DEBUG enabled.#10984
peterwilsoncc wants to merge 1 commit intoWordPress:trunkfrom
peterwilsoncc:fix/64369-only-show-sourceurl-for-script-debug

Conversation

@peterwilsoncc
Copy link
Contributor

@peterwilsoncc peterwilsoncc commented Feb 20, 2026

Modifies the sourceURL output so it's only done if the SCRIPT_DEBUG constant is set to true.

Trac ticket: https://core.trac.wordpress.org/ticket/64369

Testing notes

  1. Add define( 'SCRIPT_DEBUG', false ); to your wp-config file
  2. Generate some content with various block types
  3. Activate a classic theme
  4. Ensure the hoisted styles block do not include the sourceurl
  5. Activate a block theme
  6. Ensure the block styles do not include the sourceurl
  7. Update the defintion above to define( 'SCRIPT_DEBUG', true );
  8. Reload the page
  9. Ensure the block styles do include the sourceurl
  10. Reactivate the classic theme
  11. Ensure the hoisted block styles do include the sourceurl

Use of AI Tools

Copilot helped with auto-complete/type ahead.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@peterwilsoncc peterwilsoncc marked this pull request as ready for review February 20, 2026 03:03
@peterwilsoncc peterwilsoncc requested review from sirreal and westonruter and removed request for sirreal February 20, 2026 03:03
@github-actions
Copy link

github-actions bot commented Feb 20, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @markkap.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props peterwilsoncc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@markkap
Copy link

markkap commented Feb 20, 2026

this sounds less than optimal as it seems to lead to the next workflow

  • There is a JS error. It is hard to trace where it comes from
  • change your wp config, set debug_scripts to true
  • recreate the error to be able to pinpoint where it comes from
  • solve the bug
  • change your wp config, remove debug_scripts setting

I would go for something less conditional like show it only to admins (I am assuming all developers have or can safely be given admin role, not sure how much this assumption is true in real life)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments