Does anyone know how to query the database to find entry data based on a slug? The only table field I see that contains slug data is in craft_entryversions.data in json format. Anyone ever tried querying for matches?

  • Does it need to be a SQL query or are you open to using the built in Craft API? Commented Mar 11, 2015 at 13:35
  • Have you taken a look at the craft_elements_i18n table? Commented Mar 11, 2015 at 14:17
  • @Aaron: I have an array of slugs that I want to query for. I'm open to the API but I'm sort of new to plugin development. Not sure where to start. I imagine the API method would be better for getting images and such. If you can point me to the right direction, that would be great.
    – MrT
    Commented Mar 12, 2015 at 14:11

1 Answer 1


If you're talking about querying using SQL directly, then the craft_elements_i18n table is where all of the slugs are kept.

  • Yeah I ended up bumping into that table and I see elementId is the entry id. Getting image data gets tricky I guess.
    – MrT
    Commented Mar 12, 2015 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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