mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/78937232/hide-customer-ip-address-in-woocommerce-admin-edit-order-pages/78937404
15 lines
707 B
Text
15 lines
707 B
Text
add_action( 'admin_footer', 'admin_edit_order_script' );
|
|
function admin_edit_order_script() {
|
|
global $pagenow, $typenow;
|
|
|
|
if ( ( $pagenow === 'post.php' && $typenow === 'shop_order' && isset($_GET['post']) )
|
|
|| ( $pagenow === 'admin.php' && isset($_GET['page']) && $_GET['page'] === 'wc-orders'
|
|
&& isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id']) ) ) : ?>
|
|
<script>
|
|
jQuery('.woocommerce-Order-customerIP').remove();
|
|
const orderNumberMeta = jQuery('.woocommerce-order-data__meta.order_number'),
|
|
orderNumberMetaHTML = orderNumberMeta.html();
|
|
orderNumberMeta.html(orderNumberMetaHTML.replace('Customer IP:', ''));
|
|
</script>
|
|
<?php endif;
|
|
}
|