Skip to content

Instantly share code, notes, and snippets.

@etherealite
Created September 2, 2022 06:12
Show Gist options
  • Save etherealite/62cc233c86a61c92cb767bf557ebdc45 to your computer and use it in GitHub Desktop.
Save etherealite/62cc233c86a61c92cb767bf557ebdc45 to your computer and use it in GitHub Desktop.
Remove rewrite front from event post type archives
<?php
/**
* Plugin Name: VMA Internal Plugin
* Description: General purpose plugin for site specific integrations.
* Author: Evan Bangham
* Version: 0.0.1
* Author URI: https://github.com/etherealite
*
* Text Domain: VMA
**/
class Vma_Internal {
public static function bootstrap(): void
{
$instance = new static();
$instance->register();
}
public function register(): void
{
add_filter(
'register_taxonomy_event_listing_category_args',
[$this, 'filter_register_taxonomy_event_listing_category_args'],
10,
1
);
add_filter(
'register_taxonomy_event_listing_type_args',
[$this, 'filter_register_taxonomy_event_listing_type_args'],
10,
1
);
}
public function filter_register_taxonomy_event_listing_category_args(
array $args
): array
{
$rewrite = [
'with_front' => false,
'hierarchical' => false
];
$args['rewrite'] = $rewrite;
return $args;
}
public function filter_register_taxonomy_event_listing_type_args(
array $args
): array
{
$rewrite = [
'with_front' => false,
'hierarchical' => false
];
$args['rewrite'] = $rewrite;
return $args;
}
}
Vma_Internal::bootstrap();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment