10up / autoshare-for-twitter

Automatically shares the post title or custom message and a link to the post to X/Twitter.
https://wordpress.org/plugins/autoshare-for-twitter/
GNU General Public License v2.0
116 stars 19 forks source link

Query parameters incorrectly escaped in Tweet URL #323

Closed justinmaurerdotdev closed 6 months ago

justinmaurerdotdev commented 6 months ago

Describe the bug

When I use the `autoshare_for_twitter_post_url' filter to add query parameters, they are converted to HTML entities.

Steps to Reproduce

add_filter(
    'autoshare_for_twitter_post_url',
    function ( $url ) {
        return add_query_arg( array(
            'utm_source'   => 'x',
            'utm_medium'   => 'social',
            'utm_campaign' => 'my_test',
            'utm_content'  => 'auto-tweet',
            'utm_term'     => 'post',
        ), $url );
    }
);

Screenshots, screen recording, code snippet

The above produces URLs like this http://example.org/?p=16&utm_source=x&utm_medium=social&utm_campaign=my_test&utm_content=auto-tweet&utm_term=post instead of the expected result, like this http://example.org/?p=16&utm_source=x&utm_medium=social&utm_campaign=my_test&utm_content=auto-tweet&utm_term=post.

Environment information

No response

WordPress information

No response

Code of Conduct