Created
October 8, 2019 11:53
-
-
Save andykeith/ef801cdb07a5040665b4a72d5fb6aad7 to your computer and use it in GitHub Desktop.
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_filter( 'wc_product_table_query_args', function( $args, WC_Product_Table_Query $wpt_query ) { | |
// The 'args' property - type WC_Product_Table_Args - contains all the shortcode options used to create the table. | |
// Example checking the category option... | |
if ( 'something' === $wpt_query->args->category ) { | |
// Do something with the query args for this table | |
} | |
// Another example... | |
if ( $wpt_query->args->lazy_load ) { | |
// Do something with the query args for this table | |
} | |
// Another example... | |
if ( 'date' === $wpt_query->args->sort_by ) { | |
// Do something with the query args for this table | |
} | |
return $args; | |
}, 10, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment