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
/** | |
* Increase the number of orders shown on the Orders page in My Acccount | |
*/ | |
function mytheme_my_account_orders( $args ) { | |
// Use -1 to display all orders | |
$args['posts_per_page'] = 20; | |
return $args; | |
} | |
add_filter( 'woocommerce_my_account_my_orders_query', 'mytheme_my_account_orders', 10, 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
/** | |
* Remove the WooCommerce Marketing Menu (which also moves the Coupons menu back under the main WooCommerce Menu item) | |
*/ | |
function mytheme_remove_marketing_menu($features) { | |
$marketing = array_search('marketing', $features); | |
unset($features[$marketing]); | |
return $features; | |
} | |
add_filter('woocommerce_admin_features', 'mytheme_remove_marketing_menu' ); |
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
/** | |
* Remove the WooCommerce site visibility badge from the Dashboard Admin Bar | |
*/ | |
function mytheme_remove_woocommerce_site_visibility_badge( $wp_admin_bar ) { | |
$wp_admin_bar->remove_node( 'woocommerce-site-visibility-badge' ); | |
} | |
add_action( 'admin_bar_menu', 'mytheme_remove_woocommerce_site_visibility_badge', 100 ); |
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
/** | |
* In WooCommerce 9.4.1 a new Payments menu item was introduced. For most users, this caused a blank page to be displayed when clicked. | |
* In WooCommerce 9.4.2 it was fixed so that it no longer shows a blank page, but instead, redirects you to the Payments tab in the WooCommerce Settings. | |
* When you're not using the WooCommerce Payments Payment Gateway, this menu is completely irrelevant and just adds to the existing clutter | |
* that WooCommerce already adds into your Dashboard! | |
*/ | |
function mytheme_remove_payments_menu() { | |
remove_menu_page( 'admin.php?page=wc-settings&tab=checkout' ); | |
} | |
add_action( 'admin_init', 'mytheme_remove_payments_menu' ); |
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
/** | |
* Remove PHP Dashboard Widget | |
*/ | |
function remove_site_wp_dashboard_widgets() { | |
remove_meta_box( 'dashboard_php_nag', 'dashboard', 'normal' ); | |
} | |
add_action( 'wp_dashboard_setup', 'remove_site_wp_dashboard_widgets' ); |
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
/** | |
* Remove Site Health Dashboard Widget | |
*/ | |
function remove_site_wp_dashboard_widgets() { | |
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); | |
} | |
add_action( 'wp_dashboard_setup', 'remove_site_wp_dashboard_widgets' ); |
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 | |
/** | |
* Perform action/email when a WooCommerce order is placed on-hold | |
*/ | |
function wps_woocommerce_order_status_changed( $order_id, $checkout = null ) { | |
global $woocommerce; | |
$to = '[email protected]'; | |
$subject = ''; | |
$body = ''; | |
$headers = array('Content-Type: text/html; charset=UTF-8'); |
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 | |
/** | |
* Declare WooCommerce HPOS compatibility | |
*/ | |
function yourplugin_declare_hpos_compat() { | |
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { | |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); | |
} | |
} | |
add_action( 'before_woocommerce_init', 'yourplugin_declare_hpos_compat' ); |
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 | |
/** | |
* Check if inside WP Admin. Also works in the Block Editor. | |
* | |
* With the introduction of Gutenberg, is_admin() was broken. | |
* This better version will account for the Block Editor (Gutenberg) | |
*/ | |
function mytheme_better_is_admin() { | |
// Check if in Block Editor - see: https://github.com/WordPress/gutenberg/issues/51090#issuecomment-1576570247 | |
if ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $_GET['context'] ) ) { |
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
/** | |
* Change the default Login error message | |
*/ | |
function mytheme_login_error_msg() { | |
return 'Your username or password is incorrect.'; | |
} | |
add_filter( 'login_errors', 'mytheme_login_error_msg' ); |
NewerOlder