Avoid get_the_title texturization when auto-composing tweet #73
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 would close #72 .
@rickalee Discovered that some undecoded special characters (hyphens/dashes and quotation marks, specifically) were appearing in tweets generated by this plugin. On closer inspection, I found that the WP core function
get_the_title
was being used to generate the tweet body. That function applies several filters, one of which (unless overridden) iswptexturize
. This is where the characters were coming from.To fix it, I removed
get_the_title
in favor of accessingpost_title
from the WP post object directly.This issue only occurred when the post title was tweeted, not when custom share text was entered.
Alternate Designs
We could alternatively continue to use
get_the_title
and selectively disable only the default filters causing the character issues. In this scenario, though, we would need to immediately re-add any removed filters to avoid causing side effects elsewhere, and this could become complicated. Probably not worth the effort.Benefits
Characters in Tweets appear as expected.
Possible Drawbacks
Verification Process
Create a post whose title contains dashes and quotation marks. Turn on autosharing for the post. Publish the post. Verify that the characters appear as expected.
Checklist:
Applicable Issues
Resolves #72
Changelog Entry
Bypass character texturization when the post title is tweeted