Manual:Hooks/UnknownAction

Details
Actions for a page are passed to MediaWiki via the action parameter in the URL. For example, to edit the page 'Foo' the action  would be appended to the main article URL, giving.

This hook allows you to add custom actions to MediaWiki. If an action is requested that the software doesn't handle natively, this hook will be called.

Returning false will allow processing to continue, but it will not output any content for the page. You will need to use  and similar functions to create the appropriate page content for this action, and   to set the title for display at the top of the page.

Returning true will cause the standard 'no such action' message that you get when entering &action=nonexistant_action.

Arguments

 * $action: action name
 * $article: article "acted on" - this is a Page object, not the article name.

Migrating to $wgActions
To upgrade older code to work using the modern method of handling custom actions (required as-of MW 1.32 and recommended for MW >= 1.19) you would rewrite the above example as follows: