Skip to content

Instantly share code, notes, and snippets.

@mrfoxtalbot
Created September 16, 2022 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrfoxtalbot/922ca33001826bde273502067a0ed430 to your computer and use it in GitHub Desktop.
Save mrfoxtalbot/922ca33001826bde273502067a0ed430 to your computer and use it in GitHub Desktop.
Replace Burger menu with a different SVG icon in the Twenty Twenty-Two theme
<?php function custom_render_block_core_navigation (string $block_content, array $block)
{
if (
$block['blockName'] === 'core/navigation' &&
!is_admin() &&
!wp_is_json_request()
) {
return preg_replace('/\<svg width(.*?)\<\/svg\>/', 'add your SVG here', $block_content);
}
return $block_content;
}
add_filter('render_block', 'custom_render_block_core_navigation', null, 2); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment