Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to add categories and tags for WordPress pages?

Categories and Tags are predefined taxonomies in WordPress which are used to sort your content into sections. They make easier for your readers to find the posts what they are looking for. By default Categories and Tags are limited to only posts. While creating a post on your WordPress website, it can be categorized into different sections and can be filed under one or more categories and tags to navigate the content easily. While creating a page on your website you cannot find the option to add categories or tags to that particular page. In this article, I’ll explain how to add categories and tags for WordPress pages which helps to sort your content easily.

How to add categories and tags for WordPress pages?

You can easily add the categories and tags for WordPress pages by using 2 methods.

  • Adding code snippet to function.php file.
  • Using a plugin.

Now I’ll demonstrate how to add categories and tags for WordPress pages using above 2 ways.

1. Adding code snippet to function.php file:

WordPress being a self-hosted platform, we can easily add any type of support by adding a small code in theme function.php file.

Login to your WordPress dashboard and go to Appearance > Editor.

Open your theme function.php file and paste the below code snippet.

 register_taxonomy_for_object_type( 'post_tag', 'page' );
 register_taxonomy_for_object_type( 'category', 'page' );
 }
add_action( 'init', 'add_taxonomies_to_pages' );
 if ( ! is_admin() ) {
 add_action( 'pre_get_posts', 'category_and_tag_archives' );
  }
function category_and_tag_archives( $wp_query ) {
$my_post_array = array('post','page');
  if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) )
 $wp_query->set( 'post_type', $my_post_array );
  if ( $wp_query->get( 'tag' ) )
 $wp_query->set( 'post_type', $my_post_array );
}

This method is very simple. But In case if you change the theme in future, all changed will be lost.

2. Using a Plugin:

Login to WordPress dashboard, install and activate the Post Tags and Categories for Pages plugin.

That’s it. No need to do anything. You’ll find categories and tags option under pages.

Now you can assign categories and tags to your WordPress pages. Your pages will appear in the categories archives with posts.

I hope this article helped you to add categories and tags for WordPress pages.

Do you use categories and tags for WordPress pages, do comment and let me know.

Please share this article with your friends on Facebook, Google + and Twitter.

The post How to add categories and tags for WordPress pages? appeared first on Royal Ecash.



This post first appeared on Royalecash, please read the originial post: here

Share the post

How to add categories and tags for WordPress pages?

×

Subscribe to Royalecash

Get updates delivered right to your inbox!

Thank you for your subscription

×