URL Shortener
[resolved] using the action hooks (2 posts)

  1. 406media
    Posted 4 years ago #

    i'm having trouble figuring out how to get the shortlink to pass to twitter. i have the feeling you can get it using the new action hook, but i can't figure it out or find any documentation on it. any help would be much appreciated. thanks.


  2. Gerald
    Plugin Author

    Posted 4 years ago #

    An example usage of the hook

    function duplicate_field($post_id, $shortlink){
    	add_post_meta($post_id, 'duplicate', $shortlink);
    add_action('fts_use_shortlink', 'duplicate_field', 10, 2)

    The above code snippet will add a second custom field with the shortlink as the value...

    So, if you want to add an action to post to twitter:

    function to_twitter($post_id, $shortlink){
    	/*your twitter functions here*/
    add_action('fts_use_shortlink', 'to_twitter', 10, 2)

    For more about action hooks, check out:

    Do check the URL shortener wiki as well:
    I'll try to expand the hook documentation in the future.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • URL Shortener
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic