• Resolved joshuaiz

    (@joshuaiz)


    Hello,

    I’m trying to add placeholder text to the dropdown in a widget. In the plugin settings > Advanced options I have it set to ‘Placeholder’.

    I also have it set to ‘Placeholder’ in the widget.

    Finally, I have this filter to change/set the placeholder text in functions.php:

    function modify_categories_dropdown( $placeholder, $taxonomy ) {
    
        return 'Collections:';
    }
    add_filter( 'beautiful_filters_dropdown_placeholder', 'modify_dropdown_placeholder', 10, 2 );

    Yet there is no placeholder text in the dropdown – it’s just blank.

    If I select ‘Inherit’ in the widget settings, I get this error:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'modify_dropdown_placeholder' not found or invalid function name in /wp-includes/plugin.php on line 235

    Maybe there is an error in the plugin code? Or am I missing something?

    https://www.ads-software.com/plugins/beautiful-taxonomy-filters/

Viewing 1 replies (of 1 total)
  • Thread Starter joshuaiz

    (@joshuaiz)

    Solved:

    There’s an error in the filter code on the ‘Other Notes’ page:

    Instead of:

    function modify_categories_dropdown( $placeholder, $taxonomy ) {
    
        return 'New placeholder';
    }
    add_filter( 'beautiful_filters_dropdown_placeholder', 'modify_dropdown_placeholder', 10, 2 );

    The function needs to be named modify_dropdown_placeholder to match the filter. Took me a few days to catch it ??

Viewing 1 replies (of 1 total)
  • The topic ‘Placeholder text function not working’ is closed to new replies.