Advertisement
artemsemkin

Rhye theme: filter registered cpt/taxonomy arguments

Jul 24th, 2023
1,257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. // Custom post types
  4. add_filter( 'register_post_type_args', 'custom_filter_cpt_args', 10, 2 );
  5. function custom_filter_cpt_args( $args, $post_type ) {
  6.   if ( $post_type === 'arts_portfolio_item' ) {
  7.     // Customizations for portfolio post type
  8.   }
  9.  
  10.   return $args;
  11. }
  12.  
  13. // Taxonomies
  14. add_filter( 'register_taxonomy_args', 'custom_filter_taxonomy_args', 10, 2 );
  15. function custom_filter_taxonomy_args( $args, $taxonomy ) {
  16.   if ( $taxonomy === 'arts_portfolio_category' ) {
  17.     // Customizations for categories taxonomy
  18.  
  19.     $args['hierarchical'] = true;
  20.   }
  21.  
  22.   return $args;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement