arie_cristianD

change archive category link with custom page

Nov 3rd, 2025
1,065
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. add_filter(
  2.     'term_link',
  3.     function ( $url, $term, $taxonomy ) {
  4.         if ( 'category' === $taxonomy ) {
  5.             switch ( $term->slug ) {
  6.                 case 'jnews_demo_music': /* change with your category sliug */
  7.                     return get_permalink( 2 ); /* change 2 with your page ID */
  8.                 case 'jnews_demo_stories':  /* change with your category sliug */
  9.                     return get_permalink( 2 ); /* change 2 with your page ID */
  10.                 case 'jnews_demo_global':  /* change with your category sliug */
  11.                     return get_permalink( 2 ); /* change 2 with your page ID */
  12.                 default:
  13.                     break;
  14.             }
  15.         }
  16.  
  17.         return $url;
  18.     },
  19.     10,
  20.     3
  21. );
Advertisement
Add Comment
Please, Sign In to add comment