Advertisement
miriamdepaula

WordPress: Add tag support to pages

Jun 8th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. // Adicione estas linhas de código no arquivo functions.php do seu tema ativo.
  2. function tags_support_all() {
  3.     register_taxonomy_for_object_type('post_tag', 'page');
  4. }
  5.  
  6. function tags_support_query($wp_query) {
  7.     if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
  8. }
  9.  
  10. // tag hooks
  11. add_action('init', 'tags_support_all');
  12. add_action('pre_get_posts', 'tags_support_query');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement