Created
September 13, 2024 15:24
-
-
Save RiaanKnoetze/5193516e172554b8871236351e666cf1 to your computer and use it in GitHub Desktop.
Remove the site visibility badges (e.g. "Coming soon", "Store coming soon", and "Live") introduced by WooCommerce in version 9.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_bar_menu', function( $wp_admin_bar ) { | |
if ( is_object( $wp_admin_bar ) && $wp_admin_bar->get_node( 'woocommerce-site-visibility-badge' ) ) { | |
$wp_admin_bar->remove_node( 'woocommerce-site-visibility-badge' ); | |
} | |
}, 100 ); |
@Peter-HVD It's recommended behavior to reduce redundant line changes in Git and SVN. It's allowed since PHP 7.3 (2018) -- see https://wiki.php.net/rfc/trailing-comma-function-calls#:~:text=Status%3A%20Implemented%20(in%20PHP%207.3).
@Peter-HVD It's recommended behavior to reduce redundant line changes in Git and SVN. It's allowed since PHP 7.3 (2018) -- see https://wiki.php.net/rfc/trailing-comma-function-calls#:~:text=Status%3A%20Implemented%20(in%20PHP%207.3).
I did not know that - my IDE flags it as an error, and I've been battling with writing JSON files recently and they definitely doesn't like an extra comma, so I was in that headspace. Cheers.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@sybrew - thanks, but you've got a rogue comma after the 100 in that snippet.