Skip to content

Instantly share code, notes, and snippets.

@amostajo
Last active April 22, 2016 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amostajo/f857c828ea9be74fa06a7e54e6215ca6 to your computer and use it in GitHub Desktop.
Save amostajo/f857c828ea9be74fa06a7e54e6215ca6 to your computer and use it in GitHub Desktop.
Wordpress MVC - Add action legacy
<?php
class Main extends Plugin
{
public function init()
{
// This will call 'save_post' function located in Main class.
add_action( 'save_post', [ &$this, 'save_post' ] );
}
// Callback handler for action 'save_post'.
public function save_post()
{
// TODO CODE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment