Ici un exemple pour ajouter les étiquettes de WordPress aux pages
// add tag support to pages
function seomix_tags_support_all() {
register_taxonomy_for_object_type( 'post_tag', 'page' );
}
// ensure all tags are included in queries
function seomix_tags_support_query($wp_query) {
if ( $wp_query->get( 'tag' ) ) {
$wp_query->set( 'post_type', 'any' );
}
}
// tag hooks
add_action( 'init', 'seomix_tags_support_all' );
add_action( 'pre_get_posts', 'seomix_tags_support_query' );
Laisser un commentaire