Created
May 10, 2018 14:01
-
-
Save hwkdev/367af35ed47d732bdc68a4449bd81ac3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Taxonomy: Args | |
add_filter('register_taxonomy_args', 'hwk_dynamic_taxonomy_args', 10, 2); | |
function hwk_dynamic_taxonomy_args($args, $taxonomy){ | |
if(!apply_filters('hwk/taxonomy/' . $taxonomy . '/args/no_single', false)) | |
return $args; | |
if($args['show_ui'] === null) | |
$args['show_ui'] = true; | |
if($args['show_in_nav_menus'] === null) | |
$args['show_in_nav_menus'] = true; | |
if($args['publicly_queryable'] === null) | |
$args['publicly_queryable'] = true; | |
if($args['exclude_from_search'] === null) | |
$args['exclude_from_search'] = true; | |
$args['public'] = false; | |
$args['rewrite'] = false; | |
return $args; | |
} | |
// Taxonomy: Permalink | |
add_filter('term_link', 'hwk_dynamic_taxonomy_permalink', 10, 3); | |
function hwk_dynamic_taxonomy_permalink($link, $term, $taxonomy){ | |
if(!apply_filters('hwk/taxonomy/' . $taxonomy . '/args/no_single', false)) | |
return $link; | |
return home_url(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment