Variables with "_" not working in foreach() loop in a theme
-
Within a theme I am trying to work around the exclude_tree bug, using the code of this page : https://www.technokinetics.com/workaround-for-exclude_tree-bug-in-wp_list_pages/
I will simplify the code to get to my problem :
<?php $parent_pages_to_exclude = array(8,233); foreach ($parent_page_to_exclude as $page_to_exclude) : echo "page_id: $page_to_exlude"; endforeach; ?>
This does not work at all, and does not show any error.
When I am trying the same code naming the variables differently, I get the expected result :
<?php $lols = array(8,233); foreach ($lols as $lol) : echo "lol $lol"; endforeach; ?>
What am I missing here? Are variable names expected to not contain underscores anymore?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Variables with "_" not working in foreach() loop in a theme’ is closed to new replies.