I need to categorize search result of WordPress, I have done that through adding categories to posts and custom post types. Now, only pages are listing without any category, I think it is possible to add category to pages as well, but I am not aware of its consequences(including performance).

Kindly you share your thoughts and experience.

Thank you

  • As I have already stated to your questionon SO, the page post type are not meant to have categories, and none of the page related functions are set up for this functionality. You must think ahead and decide if you are going to need more functionality for pages with categories – Pieter Goosen Jul 13 '15 at 11:49

You can add categories and pages with a hook

function add_taxonomies_to_pages() {
 register_taxonomy_for_object_type( 'post_tag', 'page' );
 register_taxonomy_for_object_type( 'category', 'page' );
add_action( 'init', 'add_taxonomies_to_pages' );
|improve this answer|||||
  • ,thank you, I wonder why they didn't add it by default. – Dipu R Jul 14 '15 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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