1
2
3
4
5
6
7
8
9
10
11
12
add_action( ‘init’, ‘my_add_pages_categories’ ) ;
function my_add_pages_categories()
{
register_taxonomy_for_object_type( ‘category’, ‘page’ ) ;
}
add_action( ‘pre_get_posts’, ‘my_set_page_categories’ ) ;
function my_set_page_categories( $query )
{
if ( $query->is_category== true && $query->is_main_query()){
$query->set( ‘post_type’, array( ‘post’, ‘page’, ‘nav_menu_item’ )) ;
}
}