WordPress.org

Ready to get started?Download WordPress

Forums

Pretty Link Lite
[resolved] Error "This Pretty Link Slug is already taken" ... using the na (7 posts)

  1. kynnay
    Member
    Posted 2 years ago #

    Hello,

    I just discovered this nice plugin and have been using it for 2 weeks now.
    Today, I had this strange Error message :

    ERROR: This Pretty Link Slug is already taken. Check to make sure ...

    After some research I found that this message is issued (in my case) because the Pretty link I was trying to create has the exact same name than a image attached to an ancien post.
    It seems that WordPress when you insert an image in a post, create in the wp_post table a new row with post_name = image name (without ext).

    The problem come from this line in function slugIsAvailable (in file wp-content/plugins/pretty-link/classes/models/PrliUtils.php)
    $postname = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM {$wpdb->posts} WHERE post_name=%s LIMIT 1",$slug));

    I changed it to
    $postname = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM {$wpdb->posts} WHERE post_name=%s<strong> and post_parent = 0 </strong> LIMIT 1",$slug));

    Do you think it's OK to do this ?
    I used the post_parent = 0 for perfs. The best would has been using post_type <> 'attachement' I think.

    Thx for your answer.
    Kynnay

    http://wordpress.org/extend/plugins/pretty-link/

  2. Daniel J. Lewis
    Member
    Posted 2 years ago #

    Any update on this? I can't find where my slug is supposedly being taken.

  3. kynnay
    Member
    Posted 2 years ago #

    No update that I know of.

    As I remember it, this is the only place where I found this message ...

  4. cartpauj
    Member
    Plugin Author

    Posted 2 years ago #

    Can one, or some of you test the following out for us:
    Open the file: wp-content/plugins/pretty-link/classes/models/PrliUtils.php

    And comment out these two lines:

    $postname = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM {$wpdb->posts} WHERE post_name=%s LIMIT 1",$slug));
    $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM {$wpdb->term_taxonomy} WHERE taxonomy=%s LIMIT 1",$slug));

    Like:

    //$postname = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM {$wpdb->posts} WHERE post_name=%s LIMIT 1",$slug));
    //$taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM {$wpdb->term_taxonomy} WHERE taxonomy=%s LIMIT 1",$slug));
  5. Mikel Perez
    Member
    Posted 2 years ago #

    I did this test, I'm one of those that were reporting errors when creating redirection links with /go/ as part of the URL.

    Even after doing this change, if I try to create a link like:
    mydomain.com/go/recommendedproduct/

    the link is not created. It doesn't show any error, either.

  6. cartpauj
    Member
    Plugin Author

    Posted 2 years ago #

    Mike, please send me a support email. I cannot duplicate this on any of my setups. I'd like to work with you a bit more on this and see if we can't figure out exactly what's going on here.

    This form shouldn't be used for the Lite version support, but we'll make an exception for this one as if it's affecting Lite users it will also affect Pro users.

    Thanks!

    http://prettylinkpro.com/contact/

    @all - I will re-post here once this has been resolved.

  7. Daniel J. Lewis
    Member
    Posted 1 year ago #

    I'm sorry this took me so long to test. But I'm happy to report that this fix worked for me!

    My environment:
    WordPress 3.4.1 Multisite
    Pretty Link in question: /itunes
    Pretty Link works on some of the Multisite blogs, not on others.
    After commenting out the two suggested lines, the /itunes pretty link was possible to make.

    The link works, too!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic