Fix: trim whitespace from slot ID exclusions to prevent space-padded …#205
Open
trrill wants to merge 3 commits into10up:developfrom
Open
Fix: trim whitespace from slot ID exclusions to prevent space-padded …#205trrill wants to merge 3 commits into10up:developfrom
trrill wants to merge 3 commits into10up:developfrom
Conversation
…entries from failing to match
trrill
commented
Apr 9, 2026
Author
trrill
left a comment
There was a problem hiding this comment.
Added missing space before closing parentheses to appease the linting gods.
…es when we render in the input, supporting any legacy options that have extra spaces and new options that won't
dkotter
approved these changes
Apr 9, 2026
Collaborator
There was a problem hiding this comment.
Thanks for the PR @trrill, works as expected. In thinking about it a bit more though, seems ideal that we shouldn't be storing data with extra spaces in the first place. I've pushed a commit that trims that extra space prior to save and then when rendering in the settings input, trim extra spaces (for backwards-compat with previously saved values) and add an extra space back with the comma: c5b4ed6
Your change is still needed to support anyone with previously saved data but then going forward, data will no longer have that extra space.
Let me know if that all makes sense to you though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…entries from failing to match
Description of the Change
When a comma-separated list of slot IDs is entered in the plugin settings with spaces after commas (e.g.
ad--youtube1x1, ad-youtube1x1), the whitespace is preserved when building the$slot_ids_to_exclude_assocarray. This causes the serialized JavaScript object to contain space-padded keys (e.g." ad-youtube1x1") that will never match a real slot element ID, silently breaking the exclusion for those slots.The fix adds
trim()to each slot ID as it's added to the associative array, consistent with howsizes_to_excludealready handles whitespace viaarray_map/trim().How to test the Change
div-gpt-ad-123, div-gpt-ad-456AdRefreshControlJS objectslotIdsToExcludeare trimmed and match the actual slot element IDs on the pageChangelog Entry
Fixed - Trim whitespace from slot ID exclusion list entries to prevent space-padded keys from failing to match slot element IDs
Credits
Props @trrill
Checklist: