Support » Fixing WordPress » Prevent Duplicate Posts instead of adding -2 suffix

  • I have a private site where I watch various RSS feeds. I realize there are RSS readers out there for this but I like using WordPress for this for person reasons.

    Ever since my upgrade to WordPress 2.8.x the process I was using to kill duplicate posts has stopped working.

    Now the way WordPress works is if I write a post and the Title already exists the SLUG will be modified by adding a -2 to the URL/Slug. And if I do it again it will goto -3 then -4 etc…

    Does anyone have a process which will just DROP the post if it’s posted with a duplicate Title/Slug?

    Previous to 2.8.x I put a Return 0 in the Post.php code but like I said, this stopped working….



Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey

    I’m looking for a fix to this too. I thought wp_insert_post would have the ability to simply stop publication if a match was found and I can’t find a blog option/setting that would prevent it.

    It actually leaves me wondering why it’s so easy to duplicate posts when duplicate content is such a major issue on blogs?!

    I think this needs to be implemented as an option in settings in admin.






    firstly, the op was talking about duplicate post titles.

    secondly, wordpress isnt a babysitter. why the hell do people need it to do EVERYTHING for them.

    lastly, If you have trouble with duplicate content (like you describe) or even worried about that kind of scenario than youre scraping because NO-ONE is ever going to sit down and write the same post verbatim twice. and frankly, scrapers suck …so you get what you get.




    oh and another thing, duplicate content isnt such a major issue on blogs.

    lol ofcourse no one is going to write the same post twice but it’s not a human error else this thread and others like it would not exist now would they?!

    You need to look at the bigger picture. I’m a developer and I made CSV 2 POST and CSV 2 POST Plus which imports any data to use it to make posts. Like if someone has a directory of Jewish Synagogues on a basic PHP website and want to transfer to WordPress the fastest way to create the pages is import yes?

    Well some importers already exist but my own occasionally creates duplicates despite have 3 different checks in place to prevent it.

    Once I figure it out however I’m sure I’ll prevent my plugin from creating the occasional duplicates.

    That will be my education. Your education is this…

    “Title already exists the SLUG will be modified by adding a -2 to the URL/Slug” says SteveFree who knows that we need to check both title and post_name a.k.a slug for any existing matches.

    He was asking for a way to prevent duplicates because currently if you inject one million rows of data into wordpress using wordpress functions. WordPress still allows duplicates. You can check for existing title and slug to do this and so yes he was talking about duplciate post titles in order to prevent entire duplicate posts!

    Unless he is planning on multiple posts with the same content and just different titles! No.

    One last thing.

    [solicitation removed]to anyone who knows of a page showing a solid fix to duplicates when working with wp_insert_post!

    It has to include that function in the example code but I don’t think such a thing exists or is that simple.

    I’ll probably have to make a final check at the end of my script on the post I just created to see if there is another like it then delete.

    did u ever find a fix for this i just realized this became a problem after i changed my permalink arrangement…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Prevent Duplicate Posts instead of adding -2 suffix’ is closed to new replies.