Categories allow us to filter the results and limit them to a certain extent. It's an essential feature in the question-answer application so that users can directly view questions related to their topic instead of browsing all the questions. WordPress provides categories by default. However, these categories are mainly intended for posts. Therefore, we have to use custom taxonomies to create categories for custom post types such as questions. More details about taxonomies will be discussed in the following chapters.
Categorizing questions
Approving and rejecting questions
Currently, our application can post questions without any approval process. However, this is not the ideal implementation as it can create a lot of spam questions. In a well-built application, there should be a feature to approve/reject questions when needed. This feature can be easily built with WordPress admin lists. We have a list of questions in the backend, and we can use the Bulk Actions dropdown on top to add custom actions and implement this feature.
Adding star rating to answers
The author who asked the question can mark the answers as correct or incorrect. However, there can be scenarios where answers are not marked as correct are more suitable than answers marked as correct. Therefore, we can introduce star rating features to answers so that the public can rate the answers. The person who looks for the answer can consider the rating before choosing answers. Implementation of this requirement is similar to the functionality of the Mark as Correct button. We have to get a JS plugin for star rating and integrate to the interface through the comment_list function. Then we can use AJAX to mark the status of answers.
We have looked at some of the possible enhancements to such an application. You can think of many more such functionalities and implement them in your own version.
In the following chapters, we'll see the limitations in this approach in complex web applications and how we can organize things better to write quality and maintainable code.