arie_cristianD

change archive category link with custom page

Nov 3rd, 2025 (edited)
1,170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 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.         if ( 'post_tag' === $taxonomy ) {
  18.             switch ( $term->slug ) {
  19.                 case 'jnews_demo_ai-agents': /* change with your tag sliug */
  20.                     return get_permalink( 2 ); /* change 2 with your page ID */
  21.                 case 'jnews_demo_ai-agents':  /* change with your tag sliug */
  22.                     return get_permalink( 2 ); /* change 2 with your page ID */
  23.                 case 'jnews_demo_ai-agents':  /* change with your tag sliug */
  24.                     return get_permalink( 2 ); /* change 2 with your page ID */
  25.                 default:
  26.                     break;
  27.             }
  28.         }
  29.  
  30.         return $url;
  31.     },
  32.     10,
  33.     3
  34. );
Advertisement
Add Comment
Please, Sign In to add comment