Preheat your oven to 350 degrees F (175 degrees C). Grease and flour a 9x13 inch baking pan.
In a stand mixer, cream together the softened butter and granulated sugar on medium speed until light and fluffy.
Lower the mixer speed and add the eggs one at a time, beating well after each addition.
Add the shredded zucchini to the wet ingredients and mix until combined.
In a separate bowl, whisk together the flour, cocoa powder, cinnamon, salt, baking powder, and baking soda.
Gradually add the dry ingredients to the wet ingredients, beating on low speed until just combined. Do not overmix.
Stir in the milk and vanilla extract until the batter is smooth. If using, fold in the chopped walnuts.
Pour the batter evenly into the prepared baking pan.
Bake for 55-65 minutes, or until a wooden skewer inserted into the center comes out clean.
Let the cake cool in the pan for 10-15 minutes before inverting it onto a wire rack to cool completely.
Notes
For an extra moist cake, ensure your zucchini is well-drained. This cake is delicious on its own, or you can frost it with your favorite chocolate or cream cheese frosting.