Support » Plugins » Working with custom routes in wp-mvc plugin

  • Manish


    Hi there,
    I’ve been trying to develop large scale application in wordpress. Been through several plugin development best practices. And finally I’ve been reading the documentation of

    I pretty much understood its automatic (mvc) code generation tools. Its default controller functions index() & show() works pretty well.

    But, when I tried to add a custom_action(), thats where I got stuck.

    class DemoController extends MvcPublicController {
        public function hello(){

    above function hello() is only accessible by below URL:{num}

    but can’t be accessed via:

    Do I need to write any custom route to make this work? Or, am I doing anything wrong?

    • This topic was modified 2 years, 1 month ago by  Manish.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Manish


    Sorry, my bad, it works 😛

    But, yet, I need to deactivate/reactivate the plugin to make my function work as a route. Each time I add a new function.

    • This reply was modified 2 years, 1 month ago by  Manish.

    You don’t need to deactivate/reactivate each time.

    From the FAQ:

    I am getting a 404 when I add a new route

    You need to go to Settings > Permalinks and click “save”. This flushes the WordPress rewrite rules. For performance reasons, the rewrite rules are only flushed either when the plugin is activated or when the Permalinks are saved. So, if you are developing with the plugin activated and adding controller routes as you go, you need to use this approach to flush the rewrite rules and use your new URL endpoints.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Working with custom routes in wp-mvc plugin’ is closed to new replies.