0

Having issues with Wordpress error Unexpected T_PAAMAYIM_NEKUDOTAYIM

Parse error: syntax error, unexpected ')', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /Applications/MAMP/htdocs/wp-content/themes/theme/functions.php on line 5

My functions.php code:

<?php
// Navigation Menus
register_nav_menus (array(
  'primary' => --('Primaty Menu')
)); 
?>

1 Answers1

0

Your code contains two extraneous dashes, amongst other things that look a little strange. Removing the dashes allows the parser to continue.

<?php
// Navigation Menus
register_nav_menus (array(
      'primary' => ('Primaty Menu')
)); 

Incidentally, you don't have "unexpected T_PAAMAYIM_NEKUDOTAYIM", you have the parser expecting one. ("PAAMAYIM NEKUDOTAYIM" is Hebrew for "double colon").

As Kirk Beard points out, you actually should've had two underscores where you had hyphens.

Kevin_Kinsey
  • 2,285
  • 1
  • 22
  • 23
  • thanks now I understand lol. – Mendy Kastiel Apr 04 '18 at 17:02
  • You're welcome. Now would be a good time to click that this is an accepted answer ;-) – Kevin_Kinsey Apr 04 '18 at 17:03
  • where in the code should I put the "double colon" ? – Mendy Kastiel Apr 04 '18 at 17:05
  • It's not telling you that you must add one; it's saying that as it was interpreting what you had written, it was expecting one as the only valid way to continue at that point (after reading the two hyphens, I guess). Since you removed them you probably don't need them. Double colons are the "scope resolution operator" and generally used to refer to a static method or property (see http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php) – Kevin_Kinsey Apr 05 '18 at 16:30
  • See also Kirk Beard's comment for enlightenment about the problem behind the issue. – Kevin_Kinsey Apr 05 '18 at 16:31