Skip to content

Instantly share code, notes, and snippets.

@cristianstan
Last active May 30, 2020 15:46
Show Gist options
  • Save cristianstan/ccd34fe08221ab96d53bb0c3a6a05b1a to your computer and use it in GitHub Desktop.
Save cristianstan/ccd34fe08221ab96d53bb0c3a6a05b1a to your computer and use it in GitHub Desktop.
WordPress Override Taxonomy Slug.php
<?php
function modeltheme_update_taxonomy_slug() {
// Current taxonomy name (not slug) -> 'mt-listing-payment-methods'
$sermon_category_args = get_taxonomy( 'mt-listing-payment-methods' ); // returns an object
$sermon_category_args->show_admin_column = true;
// Here we will add the new slug 'payment' instead of 'payment-methods'
$sermon_category_args->rewrite['slug'] = 'payment'; /* HERE WE ADDED THE NEW LINK ------*/
$sermon_category_args->rewrite['with_front'] = false;
// re-register the taxonomy
register_taxonomy( 'mt-listing-payment-methods', 'mt_listing', (array) $sermon_category_args );
}
// hook it up to 11 so that it overrides the original register_taxonomy function
add_action( 'init', 'modeltheme_update_taxonomy_slug', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment