WordPress.org

Ready to get started?Download WordPress

Forums

Bit.ly Shortlinks
The plugin is creating two bit.ly links per page (2 posts)

  1. charlescwcooke
    Member
    Posted 2 years ago #

    Thank you for this plugin, it's excellent. There's just a little bug I've noticed.

    When I create a post, even before I save it, the plugin generates a link to the /?p= url rather than the permalink, and saves it to my bit.ly account. When I subsequently publish or title the post, the plugin generates a second bit.ly link — this time to the permalink. As a result, my bit.ly account has two links per page.

    Is there any way of preventing this?

    Thanks!

    C

    http://wordpress.org/extend/plugins/bitly-shortlinks/

  2. Riccardo
    Member
    Posted 2 years ago #

    I was having a similar issue, where a permalink would be created before the post was published (or scheduled).
    Given that for some of my content the first title is just a draft, this was causing multiple bit.ly links to be created.

    To solve the problem I slightly modified the plugin, putting the following code right at the beginning of the yoast_bitly_shortlink function:

    $mypost = get_page( $id );
      if ( !in_array($mypost->post_status, array('future', 'publish')) ) {
        return "Post must be published to get a shortlink";
      }

    I don't know if there is any reason why you'd need a shortcode earlier than that time, maybe Joost can include this patch in the next release of the plugin.

    Riccardo
    [ Signature moderated. ]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic