Anytime a new permalink route is added to WordPress, the rewrite rules must be flushed for the rule to kick in. In plugins, this is done when the plugin is activated.
- To get this task custom post type…to work properly in our plugin,…there is one more thing we need to do.…You see, right now, taskbook_cpt_init…is hooked to the init event,…which happens any time Wordpress initializes,…so you go to the back end, or do something on the front end,…or whatever, the custom post type is registered,…and that's fine.…The problem is Wordpress doesn't know that…with the custom post type,…we are also trying to rewrite…the permalink structure of the site,…so that we can go to whatever/tasks,…and get just the tasks.…
So what'll happen is, if you run this right now,…and you try to use the rest API, to go to tasks,…you'll just get a 404 message.…There's nothing there.…To get this to work, we need to register…an activation hook to tell Wordpress,…when this plugin activates, go flush all the rewrite rules,…so we get all these new permalinks to work properly.…Here's what that looks like:…First I'll set up a comment for myself,…then I'll create a function,…call it taskbook_rewrite_flush.…
Inside this function, I will call in…
- Planning the application
- Extending WordPress with a plugin
- Setting up the standalone application
- Configuring OAuth 2 in WordPress
- Building the task list view
- Building the new task view
- Creating a new task via the REST API
- Displaying conditional content
- Visualizing data using Graph.js
Skill Level Advanced
1. Plan the Application
2. Extend WordPress with a Plugin
3. Set Up the Standalone Application
Review of user flow2m 34s
4. Build the Task List View
5. Build the New Task View
6. Build the Update/View Task View
7. Bonus Features
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.