Created
December 11, 2020 17:16
-
-
Save kimcoleman/1468a1cd8d7e543afd6a0235a240f310 to your computer and use it in GitHub Desktop.
Remove the prefix if it is a category archive or post type archive.
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 | |
/** | |
* Remove the prefix if it is a category archive or post type archive. | |
* | |
* You can add this recipe to your site by creating a custom plugin, | |
* adding the customization to a Memberlite child theme, | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://memberlitetheme.com/create-a-plugin-for-customizations-to-your-memberlite-site/ | |
*/ | |
function memberlite_remove_prefix_from_the_archive_title( $prefix ) { | |
// Add any other post type archives or taxonomy labels to this array. | |
if ( in_array( $prefix, array( 'Archives:', 'Category:' ) ) ) { | |
$prefix = ''; | |
} | |
return $prefix; | |
} | |
add_filter( 'get_the_archive_title_prefix', 'memberlite_remove_prefix_from_the_archive_title' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment