From the course: WordPress: Custom Post Types and Taxonomies
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Activating the REST API on your post type - WordPress Tutorial
From the course: WordPress: Custom Post Types and Taxonomies
Activating the REST API on your post type
- One of the arguments we haven't set yet is for the REST API which should get some special attention. Aside from allowing our post type data to be accessible from outside WordPress via an API, there's another crucial feature that the REST API turns on. If we look at the post edit screen for creating a new business right now, you'll see the classic editor. The one that existed pre 5.0. The other feature that's included in the REST API support is enabling the new block or Gutenberg editor. Let's go ahead and do that now. If we reference the Code X and we scroll down towards the bottom we'll see a key called show_in_rest. There are also two other rest related arguments for rest base and rest controller class. But we will definitely leave those at the default. So let's go ahead and copy the show_in_rest key which is set by default to false. Then we'll go back to our code and under the supports key, we'll paste in show_in_rest and we'll set it to true. If we save our file and then go back…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Creating your plugin3m 16s
-
(Locked)
Building a basic custom post type5m 37s
-
(Locked)
Customizing your post type labels4m 51s
-
(Locked)
Customizing your post type settings3m 13s
-
(Locked)
Activating the REST API on your post type1m 54s
-
(Locked)
Creating a post with your post type1m 56s
-
(Locked)
Challenge: Create an events post type1m
-
(Locked)
Solution: Create an events post type2m 21s
-
(Locked)
Extending post types with custom fields2m 14s
-
(Locked)
-
-
-
-
-