I've been able to determine that a bug on my WordPress site is coming from the following code inside the widgetize.php file of my Genesis Framework parent theme:

add_filter( 'genesis_register_sidebar_defaults', 'genesis_a11y_register_sidebar_defaults' );
 * Widget heading filter, default H4 in Widgets and sidebars modified to an H3 if genesis_a11y( 'headings' ) support
 * For using a semantic heading structure, improves accessibility

 * @param array $args Existing sidebar default arguments.
 * @return array Amended sidebar default arguments.
function genesis_a11y_register_sidebar_defaults( $args ) {

    if ( genesis_a11y( 'headings' ) ) {
        $args['before_title'] = '<h3 class="widgettitle widget-title">';
        $args['after_title']  = "</h3>\n";

    return $args;

I've set up a custom filter in my child theme on 'genesis_register_sidebar_defaults' that alters the header wrap 'before title' and 'after title'. However the filter above seems to be overriding my custom filter whenever the 'genesis_a11y( 'headings' )' is present:

// Adjust Widget Titles
add_filter( 'genesis_register_sidebar_defaults', 'sp_fix_widget_titles');
if ( ! function_exists( 'sp_fix_widget_titles' ) ) {
    function sp_fix_widget_titles( $defaults ) {
        $defaults[ 'before_title' ] = '<h4 class="widget-title widgettitle"><span class="widget-headline">';
        $defaults[ 'after_title' ]  = "</span></h4>\n";

        return $defaults;

despite my attempt to remove it:

    remove_filter( 'genesis_register_sidebar_defaults', 'genesis_a11y_register_sidebar_defaults');

or replace it:

add_filter( 'genesis_a11y_register_sidebar_defaults', 'sp_fix_a11y_widget_titles');
function sp_fix_a11y_widget_titles( $args ) {

    if ( genesis_a11y( 'headings' ) ) {
            $args['before_title'] = '<h3 class="widgettitle widget-title"><span class="widget-headline">';
            $args['after_title']  = "</span></h3>\n";

        return $args;

I've played around with priorities and tried variations on the replacement filter. Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.