Skip to content

Filter Reference

Mark Root-Wiley edited this page Dec 1, 2023 · 20 revisions

Block Editor Filters

Code examples of most filters.

  • mrw_hidden_blocks - Array of blocks that are hidden by default. You can also use the following filters (v2.5.0+) to completely unhide a category of hidden blocks. This filter and its "child" filters all support a second $context parameter (v2.11.0+) to target the block editor (post), site editor (site-editor), or widget editor (widgets).
    • mrw_hidden_core_blocks - Array of hidden text and media blocks.
    • mrw_hidden_widget_blocks - Array of hidden widget blocks.
    • mrw_hidden_query_blocks - Array of the query block and all post blocks.
    • mrw_hidden_site_blocks - Array of all full site editing blocks.
  • mrw_jetpack_hidden_blocks - Array of blocks without jetpack/ prefix to hide.
  • mrw_hidden_embeds - Array of embed blocks variations hidden by default. (New in v2.4.0. Blocks were previously hidden by mrw_hidden_blocks which stopped working in WordPress 5.6.)
  • mrw_jetpack_hidden_blocks - Array of Jetpack embeds without jetpack/ prefix to hide.
  • mrw_hidden_block_styles - Nested array of core blocks and their style variations. Unset either an entire block's worth of variations or a specific one to show it.
  • mrw_hidden_block_editor_settings - An array of Block Settings hidden by the editor. Current hidden settings:
    • block-directory - The built in directory for adding custom block plugins
    • border - Border settings for everything but the pullquote
    • border-radius - Border radius setting for all blocks
    • default-color-palette - The default color palette show in addition to the theme-defined palette
    • default-gradients - The default gradient palette
    • default-style-variation - Option to select a default style variation
    • drop-cap - Drop Cap setting for Paragraph Block
    • duotone - All duotone filters
    • font-weight - Font weight settings for text-related blocks
    • font-style - Font style setting for text-related blocks
    • heading-1 - Heading 1 option in Heading Block
    • heading-5 - Heading 5 option in Heading Block
    • heading-6 - Heading 6 option in Heading Block
    • image-background - Image background setting of Group block (may be added to other blocks in the future)
    • image-dimensions - Pixel and percentage sizing of images in Image Block
    • image-file-upload - Button to upload image directly rather than through Media Library in Image, Cover, Media & Text, and Gallery Blocks.
    • image-url - Button to insert image from a URL rather than uploaded to Media Library in Image, Cover, Media & Text, and Gallery Blocks.
    • inline-code - Inline code format in the block toolbar
    • inline-image - Inline image option in the block toolbar
    • justification-group - the Justification settings for the Group block
    • keyboard - Inline keyboard format (kbd) in block toolbar
    • layout-width - The "Content" and "Wide" sizes for the Group and Cover blocks
    • letter-spacing - Letter spacing
    • line-height - Line height
    • min-height-group - The Group block's min-height setting
    • new-tabs - Option to open links in new tabs for links, buttons, and images
    • padding - Block padding
    • pullquote-border - Border setting specifically for the pullquote
    • spacing - Setting for spacing between blocks
    • sticky-postion - The position selector for the Group block
    • text-deocration - Text decoration
    • text-orientation - Text orientation
    • text-transform - Text transform
  • mrw_block_editor_hide_color_palette - Whether to display the default or theme color palette. Defaults to true (hide it). Does not hide color palette if the active theme registers its own custom palette with add_theme_support( 'editor-color-palette' ).
  • mrw_block_editor_hide_gradient_presets - Whether to display the default or theme gradient presets. Defaults to true (hide it). Does not hide gradients registered by the active theme with add_theme_support( 'editor-gradient-presets' ).

Classic Editor / Classic Block Filters

  • mrw_mce_text_style - Add custom text/formatting styles to the Styleselect options

Note: More Tag Filter Behavior

To support legacy sites that previously showed the "More Tag" button in the Classic Editor, a site that unhides the More Tag in the Classic Editor will also unhide the More Block by default.