Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this: wp_nav_menu( array( 'theme_location' => 'primary' ) );

Tags:

php

wordpress

I'm new to wordpress and php. I saw the line of code:

wp_nav_menu( array( 'theme_location' => 'primary' ) );

I understand that it is a generating my nav menu, but I would really like to get in there and change things.

Where is the array defined, and what is this => operator? What is this array access doing?

like image 890
MedicineMan Avatar asked Dec 04 '25 18:12

MedicineMan


1 Answers

This just passes a "primary" into the wp_nav_menu() function. And the => is quite simply the syntax for declaring arrays. It's a array declaration, not an access.

See also the manual http://php.net/manual/en/language.types.array.php
or Reference - What does this symbol mean in PHP?
and What does "=>" mean in PHP?

like image 200
mario Avatar answered Dec 06 '25 06:12

mario