We will use the WordPress REST API Routes to retrieve questions and scores used for building our Quiz in React. We need a route to retrieve the questions with their answers and to submit the answers so we can get our result. In this tutorial, we will proceed to our WordPress roadmap and define our custom post type, metabox and also the WordPress REST API Routes. If you have not yet learned about what we are going to build and the roadmap for each part, you can check the last article: Building a Quiz with React and WordPress REST API: Introduction. The Base Plugin In the last article, we did not create a base plugin. So let’s do that now. Create a folder in the plugins folder and name it wp-quiz-tut. Create a new php file inside that folder with the same name wp-quiz-tut.php. Inside that folder create another one and name it inc. We will use that folder for additional files. Create 2 empty php files: class-wpqr-metaboxes.php and class-wpqr-rest-api.php. This file wp-quiz-tut.php will hold the main class of our plugin that is going to be used when loading the plugin and all the dependencies. Add this code to the file. <?php /** * Plugin Name: WordPress Quiz with React * Description:
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.