Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. add_filter( 'term_link', array( $this, 'replace_term_link' ), 9000, 2);
  2. function replace_term_link ( $termlink, $term ) {
  3. if( $term->taxonomy == 'product_cat' ) {
  4. $permalinks = (array)get_option( 'product_cat_custom_permalinks' );
  5.  
  6. if( array_key_exists( (int)$term->term_id, $permalinks ) )
  7. $termlink = empty( $permalinks[$term->term_id] ) ? $termlink : $permalinks[$term->term_id];
  8. }
  9.  
  10. return $termlink;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement