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.
Description of the Change
This addresses/closes: #323
The Tweet URL was being escaped by
esc_url()
, which converts ampersands to HTML entities, breaking any query parameters.Example:
http://example.org/?p=16&utm_source=x&utm_medium=social&utm_campaign=my_test&utm_content=auto-tweet&utm_term=post
Changing the escaping to use
esc_url_raw()
seems appropriate (since the URL isn't intended for HTML rendering, but an actual link) and fixes the problem.Example:
"http://example.org/?p=16&utm_source=x&utm_medium=social&utm_campaign=my_test&utm_content=auto-tweet&utm_term=post
Note: It looks like PHPCBF got a little excited about replacing global class references (e.g.
\WP_Post
) withuse
statements in includes/utils.php. Let me know if those should not added and I can revert those bits.How to test the Change
I've added
test_filter_url_with_params()
toTestPublish_Tweet.php
, and it is working as expected (fails withesc_url()
and succeeds withesc_url_raw()
. But, you can also just add a filter to see the behavior.Changelog Entry
Credits
Props @justinmaurerdotdev
Checklist: