What would be the best way of finding a sectionId by its slug within my plugin?


This should work:

$section = craft()->sections->getSectionByHandle('sectionHandle');
$sectionId = section->id;
| improve this answer | |
  • what about categories? craft()->categories->getCategoryByHandle('handle'); is not working. – ladrua Feb 5 '16 at 11:37

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.