Title: Generating for wrong link
Last modified: August 21, 2016

---

# Generating for wrong link

 *  Resolved [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/)
 * I’m on 2.2.5 of the plugin and my users are now having an issue with some of 
   their posts. We use a plugin called [Better Post Templates](http://codecanyon.net/item/better-post-templates/5683159)
   to create templates for content that we put out on a regular basis. WP_Bitly 
   is creating the shortlink for the template and not for the actual post. The template
   plugin creates a Custom Post Type which I have UNCHECKED in wp_bitly’s settings
   to NOT generate shortlinks for, but it still is. Here is an example using one
   of our templates. The shortlink goes to the template and not the post.
 * ShortLink generated on post: [http://cpnwz.us/1brdvPz](http://cpnwz.us/1brdvPz)
 * Post it should go to: [http://coupon-wizards.com/winn-dixie-matchup-423-429/](http://coupon-wizards.com/winn-dixie-matchup-423-429/)
 * Any suggestions?
 * Mike
 * [https://wordpress.org/plugins/wp-bitly/](https://wordpress.org/plugins/wp-bitly/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838523)
 * On bitly it is showing the right URL for the post, but the shortlink goes to 
   the wrong page on our site: [https://bitly.com/1mBbEyu+](https://bitly.com/1mBbEyu+)
 *  Thread Starter [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838524)
 * Just noticed this but the shortlinks are different from what I get on the post
   and what is displayed on bitly.com as the generated link.
 * Either way both shortlinks go to the wrong URL.
 *  Thread Starter [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838532)
 * Seems like this part of the Changelog may be the problem:
 * Removed wpbitly_generate_shortlink() from save_post
 * I have a hunch that when the Template plugin is bringing its stuff into the post
   editor is when the shortlink is created and it’s pulling the template URL and
   not the post URL.
 * Can you send me the code and location to add it and I can test if that is the
   problem? The version 2.2.4 or which ever was immediately before this one worked
   just fine.
 *  [Mark](https://wordpress.org/support/users/delayedinsanity/)
 * (@delayedinsanity)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838537)
 * `add_filter( 'save_post', 'wpbitly_get_shortlink' );`
 * Line 208 of `wp-bitly.php`
 * I’ll have to do more testing on that. After creating the debug file, I noticed
   wpbitly_get_shortlink was being fired four times in rapid succession (not from
   drafts or revisions) and was hoping to cut down on that.
 *  Thread Starter [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838539)
 * Sorry, that did not fix it. Hate to say but the official plugin worked just fine.
   I may have to enable that one for now until this gets resolved. I have this on
   9 different sites, so I’ll keep one with wp_bitly to keep an eye on the issue.
 *  [Mark](https://wordpress.org/support/users/delayedinsanity/)
 * (@delayedinsanity)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838545)
 * I’m sorry, I gave you the wrong code.
 * `add_action( 'save_post', 'wpbitly_generate_shortlink' );`
 * Is what you want, not `wpbitly_get_shortlink`.
 *  [Mark](https://wordpress.org/support/users/delayedinsanity/)
 * (@delayedinsanity)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838547)
 * I just checked… I’m not sure when I removed the post types check. 🙂 It’ll be
   back in there on the next release.
 * I blame confusing work and play.
 *  [Mark](https://wordpress.org/support/users/delayedinsanity/)
 * (@delayedinsanity)
 * [12 years ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838791)
 * Hayesmd, I’ve just peppered the forum with this question so it can’t hurt to 
   keep going; would you care to try beta testing the next copy before I release
   it as a version update?
 * Less releases, more bug fixes is the plan, and I haven’t quite got the hang of
   unit testing for this yet.
 *  Thread Starter [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838792)
 * Sure, I don’t mind loading beta’s on less important sites of ours. We have 7 
   or 8 sites that rely on this plugin, so it only makes sense for us to do our 
   part and help out where we can. I can definitely load it on 1 or 2 where the 
   shortlinks get posted to Facebook daily so the writer can definitely let me know
   of their experience.
 *  [Mark](https://wordpress.org/support/users/delayedinsanity/)
 * (@delayedinsanity)
 * [12 years ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838793)
 * Send me your email,[ through this](http://mark.watero.us/contact/) if you don’t
   want to post it here (and I understand not wanting to, which is why I’m offering
   the link!).
 *  Thread Starter [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * (@hayesmd)
 * [12 years ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838794)
 * Just sent through the link.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Generating for wrong link’ is closed to new replies.

 * ![](https://ps.w.org/wp-bitly/assets/icon.svg?rev=3272740)
 * [Bitly's Wordpress Plugin](https://wordpress.org/plugins/wp-bitly/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-bitly/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-bitly/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-bitly/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-bitly/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-bitly/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [hayesmd](https://wordpress.org/support/users/hayesmd/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/generating-for-wrong-link/#post-4838794)
 * Status: resolved