Advertisement
hendrajeg

Filter tag cloud

Jan 19th, 2022 (edited)
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. add_filter( 'widget_tag_cloud_args', 'filter_tag_cloud_widget', 10, 2 );
  2.  
  3. function filter_tag_cloud_widget( $args, $instance ) {
  4.     /** Check if Taxonomy is Tags and Element ID or Extra class name settings is footer */
  5.     if ( isset( $args['taxonomy'] ) && 'post_tag' === $args['taxonomy'] && ( 'footer' === $instance['el_id'] || 'footer' === $instance['el_class'] ) ) {
  6.         $tag_id          = array( 258, 301, 4224 ); /* Tag ID */
  7.         $args['include'] = $tag_id;
  8.     }
  9.  
  10.     return $args;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement