Viewing 2 replies - 1 through 2 (of 2 total)
  • coffeemonk,

    I’m seeing this too, but with a bit more info. When I create a post, and save a draft, it seems bit.ly shortlinks generates a link with the WP shortcode rather than the clean-url. When I then publish the post later, it generates ANOTHER bit.ly link with the clean-url. So bit.ly has two links for most of my posts…

    That said, the “bit.ly stats” link in the admin bar seems to always go to the bit.ly link based on the WP shortlink, not the clean-url based one.

    Looking at the code, it seems Yoast knew this might happen, and has an if that says
    if ( ( is_singular() && !is_preview() ) || $context == 'post' ) {
    but either WordPress changed something, or “!is_preview” isn’t doing what it should be doing.

    Maybe a check to see if the post is a draft would be better… something like:
    if ((is_singular() && !is_preview() && $post['post_status'] == 'publish')

    Oh, crap… I know what the problem is… it’s a typo. It SHOULD read:

    if ( ( is_singular() && !is_preview() ) || $_context == 'post' ) {

    Notice the $_context and not just $context. I don’t know if that’ll fix this issue, but it is a typo, as $_context is a real variable used for what a post is doing, displaying, posting, saving, etc.

    Hopefully Joost will be able to confirm/deny this…

    any news about this issue???
    Should I edit this line:
    if ( ( is_singular() && !is_preview() ) || $context == 'post' ) {

    with this one:
    if ( ( is_singular() && !is_preview() ) || $_context == 'post' ) {

    ???

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘BUG? using WP shortlink to generate bit.ly link…’ is closed to new replies.