WP to Twitter
How to add properties to URL before shortening (2 posts)

  1. zintro
    Posted 2 years ago #

    Hi Joe,

    I hope you can help me,

    I am trying to track all twitter traffic by adding a property ?aff=tw to all URLs before the shortening happens. How can I add it?

    Thank you very much for your support.


  2. Joe Dolson
    Plugin Author

    Posted 2 years ago #

    Hmmm. There's a way to do it using a custom filter.

    There's a filter applied to links prior to sending them for shortening called 'wpt_shorten_link', which excepts as arguments the link itself and the post ID for the post being handled. If you add a function to that filter that adds that attribute to the URL, that would work.

    You'll want to look at the codex for add_filter:


    This is fairly advanced, but WP to twitter doesn't have a system for adding custom attributes to the URL. Alternately, you can add a URL in a custom field that you use instead of the default permalink; but that would be more labor intensive in the long run.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP to Twitter
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic