Preheat the oven to 350°F (175°C) and line a muffin tin with paper liners.
In a bowl, whisk together the flour, baking powder, baking soda, salt, and cinnamon.
In another large bowl, cream the softened butter and sugar until light and fluffy.
Add the eggs one at a time, mixing well after each addition.
Stir in the vanilla extract.
Gradually mix the dry ingredients into the wet ingredients until just combined.
Fold in the diced apples and walnuts (if using).
Scoop the batter into the muffin liners, filling them about 2/3 full.
Bake for 20-25 minutes or until a toothpick inserted comes out clean.
Let the muffins cool in the pan for 5 minutes before transferring to a wire rack to cool completely.