• Resolved skindy

    (@skindy)


    I recently checked my Bit.ly account to see what my stats were and noticed that the plugin is creating Bit.ly links on autosaves and revisions for each post. I didn’t know if this was just something we just had to deal with or something you can fix. I hope it’s something fixable!

    I am also having the same issue with Publicize but I know there is an on-going thread about that right now.

    Thanks!

    https://wordpress.org/plugins/wp-bitly/

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

    (@delayedinsanity)

    I can’t fathom why it would be doing that for you. There’s only one function that does the actual work of generating shortlinks and it checks against autosaves and revisions. Has since the beginning, I haven’t changed it much if at all over time.

    Do you have any plugins that interact with autosaves or revisions in any way whatsoever?

    Getting a similar problem on one of our sites. Not sure what is the cause yet.

    I haven’t changed it much if at all over time.

    Has changed a bit though. Out of interest why you don’t just end execution of the function wpbitly_generate_shortlink when wp_is_post_revision returns with an ID?

    Same here. The BITLY plugin is creating a number of revisions for each post while creating or editing.

    Eg. http://domain.com/102-revision-v1/, http://domain.com/103-revision-v1/, http://domain.com/104-revision-v1/

    I have no additional plugins that affect posting or updating either.
    Has anyone figured out how to get around this?

    Mark

    (@delayedinsanity)

    wp_is_post_revision() returns, according to the codex:

    False if not a revision, ID of revision’s parent otherwise.

    The concept was that given the parent post ID it would use that as the basis for generating the shortlink. Back in the day I decided to go that route as a failsafe to make sure the link was being generated, and since it never generated links for revisions in any of my tests, I assumed it was working across the board.

    Going forward, if wp_is_post_revision() returns anything other than false it will exit out of wp_generate_shortlink(). I’m curious why it wasn’t successful in using the parent ID, but that’s an issue for another day.

    Thread Starter skindy

    (@skindy)

    I’ve tried deactivating plugins and it’s still generating multiple links for revisions and autosaves 🙁

    Mark

    (@delayedinsanity)

    I could swear I updated that for 2.3.0, but I’m going to double check…

    …yep, 2.3.0 bails if wp_is_post_revision() returns anything but false. It also bails out if DOING_AUTOSAVE is set. At least it’s supposed to, and off the top of my head I can’t see any way it could be bypassing those checks.

    I might have to release a patch that grabs the results of all those checks and logs them in the debug file.

    Thread Starter skindy

    (@skindy)

    Hi Mark. Just wondering if there has been an update on this issue? No rush as it’s not causing any usability issues. It’s just a headache to sift through on Bitly 😛

    Mark

    (@delayedinsanity)

    How are they appearing on Bitly? I’m guessing with the ?p=XXX query string?

    Out of curiosity are you able to look some of the IDs up in you posts table and see if they truly are a mix of revisions and autosaves or if it’s one particular type? It would help me narrow down where the issue is.

    Outside of that, and in all honesty, I haven’t had much time to look into it. It’s not a low priority on the WP Bitly roadmap, but work taking up a large amount of my time.

    Hi Mark,

    Only updated today but it appears that your latest update ie. exiting out of the wpbitly_generate_shortlink function have corrected this problem.

    Thanks again for a very helpful plugin.

    Mark

    (@delayedinsanity)

    Good to hear, I definitely hope @skindy finds the issue resolved a well.

    A big thanks to everyone who helped track down the problem, in this thread and in others!

    Thread Starter skindy

    (@skindy)

    Woo! Updated and tested on three new posts. I can say that only one Bit.ly link was generated for each. Great work! Sorry I couldn’t update earlier, been so swamped.

    Thanks so much for updating and for such a great plugin 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Plugin generating links on autosaves and revisions’ is closed to new replies.