Site icon Hip-Hop Website Design and Development

Watch that a slug is available in the get_terms demand

I need to enable clients to make different custom post from the frontend, yet relying upon the alloted scientific classification, return the custom post structure connected to it. So in the wake of having gotten the chosen scientific categorization, it is inconceivable for me to check on the off chance that it exists in the get_terms() request.

I thougt it was on the grounds that the in_array() work doesn’t work really hard when it is about multidimensional cluster. so I looked and find here an approach to make another capacity that conquer that issue, yet it stil doesn’t work.

Here’s my code:

<?php 

$cptTax = $_GET['choosetax']; 

$tax1List = get_terms([
                        'taxonomy' => 'tax1',
                        'hide_empty' => false,
                    ]); 

work in_array_r($needle, $haystack, $strict = bogus) { 

foreach ($haystack as $item) { 

in the event that (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) { 

bring valid back; 

} 

} 

return bogus; 

} 

in the event that( in_array_r($cptTax, $tax1List, bogus)): ?> 

<form action="action" method="post" enctype="multipart/structure data"> 

I checked the $tax1List variable with a var_dump() and the slug is there… yet, the capacity return false.

Much obliged for your help