Skip to content

Instantly share code, notes, and snippets.

@michaeluno
Created December 3, 2020 07:55
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 michaeluno/941e04edcd4f3a425ab08ee1d60678b8 to your computer and use it in GitHub Desktop.
Save michaeluno/941e04edcd4f3a425ab08ee1d60678b8 to your computer and use it in GitHub Desktop.
A WordPress plugin that demonstrates the use of overloading magic method.
<?php
/**
* Plugin Name: Test - Overloading Magic Method
* Description: Tests overloading matic methods.
* Author: Michael Uno
* Author URI: http://en.michaeluno.jp/
* Version: 0.0.1
*/
class TestOverloadingMagicMethod {
public function __construct() {
add_action( 'do_something', array( $this, 'doSomething' ) );
add_action( 'plugins_loaded', array( $this, 'load' ) );
}
public function load() {
do_action( 'do_something' );
}
public function __call( $sName, $aArguments ) {
error_log( 'Called the method: ' . $sName );
}
}
new TestOverloadingMagicMethod;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment