Created
July 11, 2019 18:50
-
-
Save lgedeon/99ee6e7c84a1d316ba4895fee00279fa to your computer and use it in GitHub Desktop.
Build a regex pattern to detect taxonomy archive pages
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 | |
| $taxonomies = get_taxonomies( [], 'objects' ); | |
| $rewrites = wp_list_pluck( $taxonomies, 'rewrite' ); | |
| $slugs = array_filter( wp_list_pluck( $rewrites, 'slug' ) ); | |
| $archive_pattern = sprintf( '~/[%s]/~', implode( '|', $slugs ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment