2

I have an entry slug like this: cics-west-belden-1

the -1 seems to be auto appended to the slug, but there are no other entries with the project cics-west-belden in my project. When I remove the -1 from the end of the slug and save, the -1 always comes back. changing it to cics-west-belden-2 saves works. Even changing it to cics-west-belden- works.

But as soon as I try to save it as cics-west-belden, it changes back to cics-west-belden-1 again.

Is this a bug with craft or maybe my database somehow got corrupted where it thinks this entry already exists when in fact it doesn't

4

I don't know the specific rules Craft uses but I believe Craft auto appends the -1 when it tries to save an Element that has a matching URI in the craft_elements_i18n table.

A few scenarios that I can think of that may behave like you describe:

  1. Somehow, there is an existing record in your database that matches the URI of your Entry using the cics-west-belden slug
  2. You have another Section, Category Group, or other custom Element set to generate URIs in the same format as the Section you are posting the Entry to which already has an Element saved using your cics-west-belden slug.

To rule out the scenario where a matching record already exists in your database, open your database and look in the craft_elements_i18n table. Search for all records that match your slug and see if you only find the one:

SELECT *
FROM craft_elements_i18n
WHERE slug = 'cics-west-belden';

To confirm that no other URIs already match your Entry, you could do a similar search in the URI table:

SELECT *
FROM craft_elements_i18n
WHERE uri LIKE '%cics-west-belden%';
1
  • yeah for some reason this record exists in the mysql database but not showing up when I search in craft admin panel. Deleting it from the database directly using the mysql console worked great! – ChaiTea Aug 2 '16 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.