What are terms and taxonomy, how they related to post and how these three are stored in database?

  1. What are the terms and taxonomy in wordpress?

From WordPress.org’s Taxonomy Codex

In WordPress, a “taxonomy” is a grouping mechanism for some posts (or links or custom post types)…

The names for the different groupings in a taxonomy are called terms.

Using groupings of animals as an example, we might call one group “birds”, and another group “fish”. “Fish” and “birds” are terms in our taxonomy.

This snippet can be read in detail on their page.

  1. how terms and taxonomy relates to post and how post , terms , taxonomy are stored in database.

In your database you get a number of tables relating to terms and taxonomy. They are, wp_term, wp_term_relationships, wp_term_taxonomy.

One taxonomy you will always have is a Category. For example, Uncategorised, is a Term within the Taxonomy. In your database then you will find that the wp_term_taxonomy has a term_id column, this is the foreign key, which is the primary key of the wp_term – this is how the taxonomy and the term are linked in the database. The wp_term_relationship table simple holds the post ID foreign key (as Object) and the term_taxonomy_id … in essence this is a link table.

enter image description here

  1. What are the relationship between these three?

So you go to the Category page and make a new Category called ‘New Cat’. You now have a Taxonomy (Category) and a Term (New Cat) … you then make a post and add it to that Category, and now you have a Post linked to that Term and Taxonomy.

The ‘category’ taxonomy lets you group posts together by sorting them into various categories. These categories can then be seen on the site by using ‘/category/name’ types of URLs. Categories tend to be pre-defined and broad ranging.

For your actual problem… you could potentially use the Categories to define aspects of the property such as location, property type (detached, semi, terraced) Alternatively you can look into utilizing the Tag taxonomy.

The ‘post_tag’ taxonomy is similar to categories, but more free form. Tags can be made up on the fly, by simply typing them in. They can be seen on the site in the ‘/tag/name’ types of URLs. Posts tend to have numerous tags, and they are generally displayed near posts or in the form of tag clouds.

Also you can develop custom taxonomies however these require registering for you to use. You may find a plugin that could aid with this.

I’m not sure how much this helps with your actual problem but should give you some ideas and help you understand how they work.