Skip to content

Instantly share code, notes, and snippets.

@rayflores
Created March 6, 2018 04:29
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 rayflores/076d39c1b65153a82a57c9c7a7bbc297 to your computer and use it in GitHub Desktop.
Save rayflores/076d39c1b65153a82a57c9c7a7bbc297 to your computer and use it in GitHub Desktop.
WooCommerce Make Orders Table Rows Not Clickable
<?php
/* Plugin Name: WooCommerce Orders Table Rows Not Clickable
* Plugin URI: https://rayflores.com
* Description: Orders table rows are no longer clickable on <td> element
* Version: 1.0
* Author: Ray Flores
* Author URI: https://rayflores.com
*/
/**
* Add "no-link" class to tr's from WooCommerce orders screen
* Link: https://github.com/woocommerce/woocommerce/pull/18708
* Hook reference: https://developer.wordpress.org/reference/hooks/post_class/
* Tested with: WooCommerce 3.3.3
*/
add_filter( 'post_class', function( $classes ) {
if ( is_admin() ) {
$current_screen = get_current_screen();
if ( $current_screen->base == 'edit' && $current_screen->post_type == 'shop_order' ) $classes[] = 'no-link';
}
return $classes;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment