Remove the "Sticky" Position Option From Blocks
Hides the Position: Sticky setting from Group blocks in the editor, so editors cannot accidentally pin sections to the top of the screen.
Opens WPIDE on
Code
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) {
return $theme_json->update_with( array(
'version' => WP_Theme_JSON::LATEST_SCHEMA,
'settings' => array( 'position' => array( 'sticky' => false ) ),
) );
} );
Notes
Blocks already set to sticky keep that setting.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.