WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. zintro
    Member
    Posted 1 year 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.

    http://wordpress.org/extend/plugins/wp-to-twitter/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 1 year 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:

    http://codex.wordpress.org/Function_Reference/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

About this Topic