[Plugin: Pretty Link Lite] Error "This Pretty Link Slug is already taken" … using the na
-
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
- The topic ‘[Plugin: Pretty Link Lite] Error "This Pretty Link Slug is already taken" … using the na’ is closed to new replies.