2

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? – Aaron Berkowitz Mar 11 '15 at 13:35
  • Have you taken a look at the craft_elements_i18n table? – Josh Angell Mar 11 '15 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 Mar 12 '15 at 14:11
3

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

| improve this answer | |
  • Yeah I ended up bumping into that table and I see elementId is the entry id. Getting image data gets tricky I guess. – MrT Mar 12 '15 at 14:12

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.