Skip to content
Docs
Get RestroPress

Developer Docs

Updated 2 min read
On this page

RestroPress is built to be extended. This reference covers everything the plugin gives developers to work with, taken from the RestroPress 3.4.11 source: every action and filter it fires, every global function it defines, and its REST API, AJAX actions and URL actions.

What is in the reference#

  • Actions: hooks that run at a point in the order flow, so you can add behaviour. Open the Actions list.
  • Filters: hooks that pass a value through so you can change it. Open the Filters list.
  • Functions: the global functions, grouped by topic: cart, checkout, orders, menu items, discounts, customers, emails, gateways, settings, taxes, templates and more. Open the Functions list.
  • Interfaces: the REST API, AJAX actions and URL and form actions.

Each hook page lists its parameters and types, what a filter must return, a working example, and the file and function it is fired from. Each function entry shows the signature, parameters, return value and where it is defined.

Names you will see in the code#

The admin and these docs say Menu Items and Add-on Groups, but code identifiers keep their original names. A menu item is the fooditem post type, categories use the food-category taxonomy, add-on groups use addon_category, and shortcodes such as [fooditems] are unchanged. Orders are stored as the rpress_payment post type. Functions and hooks use the rpress_ prefix, and some newer ones use rp_.

Using a hook#

Put your code in a small plugin or your child theme's functions.php, never in RestroPress itself, so an update does not remove it. Register a callback with add_action() or add_filter():

// Record when an order is marked Paid (payment status 'publish').
function my_on_payment_status( $payment_id, $status, $old_status ) {
	if ( 'publish' === $status ) {
		update_post_meta( $payment_id, '_my_paid_at', time() );
	}
}
add_action( 'rpress_update_payment_status', 'my_on_payment_status', 10, 3 );

The third number is the priority (lower runs first) and the fourth is how many parameters your callback accepts. A filter callback must always return a value. When you are not sure which hook to use, search the reference for a word from the screen or email you want to change, for example checkout or receipt.

Before you rely on a hook#

  • Some hooks are internal plumbing for admin screens. Each page says whether a hook is meant to be extended.
  • Hooks that carry a note about a quirk (for example a result that core ignores) are documented as they behave in 3.4.11.
  • Extensions add their own hooks, documented on each extension's page.

In this section

Was this page helpful?