If you updated to the latest version of Elementor for WordPress, and noticed that the font size option has disappeared from the heading widget, you’re not alone. I spent quite a bit of time trying to figure out what was wrong with the websites we manage, because the option appears sometimes but not all the time. Here’s why the font size feature in Elementor’s heading widget disappeared and how to re-enable it.
What Happened?
The developers had removed the feature with the following code found in /elementor/includes/widgets/heading.php:
$this->add_control(
'size',
[
'label' => esc_html__( 'Size', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor' ),
'small' => esc_html__( 'Small', 'elementor' ),
'medium' => esc_html__( 'Medium', 'elementor' ),
'large' => esc_html__( 'Large', 'elementor' ),
'xl' => esc_html__( 'XL', 'elementor' ),
'xxl' => esc_html__( 'XXL', 'elementor' ),
],
'default' => 'default',
'condition' => [
'size!' => 'default', // a workaround to hide the control, unless it's in use (not default).
],
]
);
Basically, any existing heading widget has the font size option set will continue to work, but any new instances of the widget won’t. Unsure of why the developers did this, I searched the web and briefly viewed the product’s roadmap, but couldn’t find any answer. Elementor support told me to reach out on Github instead, which I did but never gotten a reply.
Re-enabling the Feature
Without knowing what the developer’s plan is for this feature, the following solution might be a short term one. But I can’t imagine them sunsetting a feature without providing backward compatibility. For now, this is one way to get it back:
add_action( 'elementor/element/heading/section_title/before_section_end', function( $widget, $args ){
// Check if the size control exists
$size_control = $widget->get_controls( 'size' );
if ( $size_control ) {
// Update the condition of the size control to ensure it's always visible
$widget->update_control(
'size',
[
'condition' => [], // Remove specific condition to make it always visible
]
);
}
}, 10, 2);
This code was slightly modified for brevity, but should work. If you know why they’ve removed this feature or their future plan for it, please let us know using our contact form.