If you want to change the heading levels for widgets in a sidebar, you shouldn’t use actions or filters or css to override WordPress: what you do is change how the sidebar is *defined* when it is first initialised.
If your theme uses a sidebar, it has to register it first. Somewhere in your theme (usually in your functions.php
file) you will find a call to the register_sidebar( $args );
function, where $args
is either a string or an array that defines how the sidebar is structured.
If there are no arguments for the register_sidebar()
call then the defaults are used – this is to use h2
for the widget titles. If you want to use a different heading (or none at all) then you need to set the values for 'before_title'
and 'after_title'
when you call register_sidebar()
like this:
__( 'Right Hand Sidebar' ), 'id' => 'right-sidebar', 'description' => __( 'Widgets in this area will be shown on the right-hand side.' ), 'before_title' => '', 'after_title' => '
' )); ?>