0

I'd like users to be able to assign a category to a page by selecting from the page dashboard. So when they create a new page they can select the post category they want to be linked and display on that page.

Is this possible?

1 Answer 1

0

add this code into functions.php and a taxonomy box will be created for page from where user can make categories for page.

<?php
add_action( 'init', 'create_book_tax' );

function create_book_tax() {
    register_taxonomy(
        'genre',
        'page',
        array(
            'label' => __( 'Genre' ),
            'rewrite' => array( 'slug' => 'genre' ),
            'hierarchical' => true,
        )
    );
}
?>
2
  • What I meant was to choose an existing category from the posts section on the page that you want to assign the posts category too. Commented Feb 21, 2018 at 17:21
  • for that you just has to change genre term with category. and that's it. Commented Feb 22, 2018 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.