WordPress.org

Ready to get started?Download WordPress

Forums

Bit.ly Shortlinks
BUG? using WP shortlink to generate bit.ly link... (3 posts)

  1. coffeemonk
    Member
    Posted 3 years ago #

    I haven't had time to dig into this yet, but it seems that the plugin is generating bit.ly links from the WordPress shortlink... in other words, my bit.ly links are pointing at http://www.coffeemonk.com/?p=827 rather than the long URL which should be the real permalink.

  2. staze
    Member
    Posted 3 years ago #

    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...

  3. frabe
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic