Skip to content

Instantly share code, notes, and snippets.

@fitzhaile fitzhaile/enable_tags.php
Last active Dec 20, 2015

Embed
What would you like to do?
WP: Enable Page tags
<?php
// Include the following in functions.php
//-------------------------------------------
// add tag support to pages
function tags_support_all() {
register_taxonomy_for_object_type('post_tag', 'page');
}
// ensure all tags are included in queries
function tags_support_query($wp_query) {
if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
}
// tag hooks
add_action('init', 'tags_support_all');
add_action('pre_get_posts', 'tags_support_query');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.