Here's my apply_filters function to return select box options:
function my_shortcode_filters(){
$handle = ''; $value = apply_filters('my_add_shortcode', $handle);
if($value) $handle = "<option value='$value'>$value</option>";
return $handle;
}
Here's the html where I call the function:
<select id="my-selectbox">
<?php echo my_shortcode_filters(); ?>
<option value="">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
And here are the add_filter functions I'm testing with:
add_filter('my_add_shortcode', 'yourprefix_new_sc_handle', 10);
function yourprefix_new_sc_handle(){
return 'myhandle';
}
add_filter('my_add_shortcode', 'yourprefix_new_sc_handle2', 11);
function yourprefix_new_sc_handle2(){
return 'myhandle2';
}
But only the second add_filter function is added to the dropdown menu. If I remove the second function, the first one is added. But when I add the second function, it overwrites the first add_filter. What am I missing here?