WordPress Taxonomies Add category in page


Example

You can also add same custom created taxonomy into post type page using below code.

function add_taxonomies_to_pages() {
     register_taxonomy_for_object_type( 'genre', 'page' );
 }
add_action( 'init', 'add_taxonomies_to_pages' );

Add above code into your theme's functions.php file. Same way you can add custom or default post_tag into post type page.

To get pages using custom taxonomy query need to add below code in same file.

if ( ! is_admin() ) {
     add_action( 'pre_get_posts', 'category_and_tag_archives' );
 }

function category_and_tag_archives( $wp_query ) {
    $my_post_array = array('page');
    if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) )
    $wp_query->set( 'post_type', $my_post_array );
}