Skip to content
Sign in Get started
Menu
Developer docs menu

Hooks

Applies to Theme 1.0.3 and Companion 1.0.3 Updated 5 November 2026 View as Markdown

These filters are part of the public API. Add them in a child theme's functions.php or in your own plugin, never in the theme or Companion, which updates replace.

lanternwp_welcome_steps

Theme, since 0.2.1. Filters the steps of Appearance → LanternWP. Each step is an array with a title, a text, whether it is done and its actions, each a label and a url, and optionally primary for the step's main button. A step or an action without that shape is left out, so a mistake leaves the screen as it was.

Since 0.5.0 a step may name its section: setup, the default, puts it in Finish setting up, where it is numbered while left, shows one button (the primary action, else the first) and, once done, folds with a Change link to its first action; yours puts it in Make it yours, where it is never done: the whole row links to its first action, whose label and an arrow stand at the row's end, and the others are links under its text. A step without a section, or with another value, stays in Finish setting up, so filters written before 0.5.0 work unchanged.

Since 0.5.0 a step may also name its icon, which Make it yours shows before its title: a Dashicon's name, such as admin-home (dashicons-admin-home works too). Without one, or with a value that is not a Dashicon's name, the row shows admin-generic, the icon WordPress gives a menu without its own. Finish setting up shows numbers, not icons.

An agency can add its own setup step for a client, and a place it comes back to:

add_filter( 'lanternwp_welcome_steps', function ( array $steps ): array {
	$steps[] = [
		'title'   => __( 'Connect your payment provider', 'my-agency' ),
		'text'    => __( 'The store takes cards once it is connected.', 'my-agency' ),
		'done'    => my_agency_payments_ready(),
		'actions' => [
			[
				'label'   => __( 'Payment settings', 'my-agency' ),
				'url'     => admin_url( 'admin.php?page=wc-settings&tab=checkout' ),
				'primary' => true,
			],
		],
	];
	$steps[] = [
		'title'   => __( 'Store emails', 'my-agency' ),
		'text'    => __( 'The order emails your customers get, in your colors.', 'my-agency' ),
		'done'    => false,
		'section' => 'yours',
		'icon'    => 'email',
		'actions' => [
			[
				'label' => __( 'Edit the emails', 'my-agency' ),
				'url'   => admin_url( 'admin.php?page=wc-settings&tab=email' ),
			],
		],
	];

	return $steps;
} );

lanternwp_welcome_status

Theme, since 0.5.0. Filters the line of the store's state under the name of Appearance → LanternWP: a list of short strings the screen joins with dots, by default the demo the store started from (lanternwp_store_demo), the look, the products and the shipping zones. A part that is not a non-empty string is left out.

add_filter( 'lanternwp_welcome_status', function ( array $parts ): array {
	$parts[] = __( 'Hosted by My Agency', 'my-agency' );

	return $parts;
} );

lanternwp_welcome_tabs

Theme, since 0.5.0. Filters the tabs of Appearance → LanternWP. The theme draws the screen's name, its state line and, once there are two tabs or more, a bar of tabs under it; under them each tab prints its own body. Overview, the theme's, is always first; LanternWP Companion adds Features and Demos. Each tab is the same page with &tab=<id>, so Appearance → LanternWP stays highlighted in the menu under every tab.

Add a tab under its id, lowercase letters, digits, - and _, as an array with its label and a render callable that prints its body. Optional keys: capability, which a user needs to see the tab (edit_theme_options by default); count, a number shown beside the name, such as things that need setup (0 shows none), with count_label, the words a screen reader says for it; and enqueue, a callable run on admin_enqueue_scripts while the tab is open. A tab without a label or a callable render, or under another id, is left out, and an address with a tab the screen does not have opens Overview. The screen's stylesheet (handle lanternwp-admin) is loaded under every tab.

add_filter( 'lanternwp_welcome_tabs', function ( array $tabs ): array {
	$tabs['my-agency'] = [
		'label'      => __( 'Support', 'my-agency' ),
		'capability' => 'manage_options',
		'render'     => function (): void {
			echo '<p>' . esc_html__( 'Write to support@my-agency.example for help with your store.', 'my-agency' ) . '</p>';
		},
	];

	return $tabs;
} );

lanternwp_store_demo

Theme, since 0.5.0. Filters the demo the store started from: an array with its id, such as base, which is also the id of its look, and its name, such as Common Goods; or null when the store has no demo. Appearance → LanternWP then says Started from the Common Goods demo or No demo yet at the head of its state line, in a store with WooCommerce, and names that demo's look after it: Look: Common Goods, Apply Common Goods again. The default, false, means nothing on the site knows, and the screen says nothing of a demo. Companion returns the demo its last import brought; a value in another shape counts as false.

add_filter( 'lanternwp_store_demo', fn () => [ 'id' => 'base', 'name' => __( 'Our starter store', 'my-agency' ) ] );

lanternwp_store_page

Theme, since 0.5.0. Filters the page a store page's links lead to, by its role: contact (the header's Help link, Contact us on the help pages and the page not found) or returns (the product page's delivery details and the help links on the contact and about pages), and the contact-page and returns-page fields of the lanternwp/store bindings (child themes). Return a page's id; the default, 0, means none. The theme keeps no choice of its own: a link whose page is not chosen, or is not a published page, is left out. Companion returns the pages chosen in its Settings → Reading → Store pages.

add_filter( 'lanternwp_store_page', function ( int $page_id, string $role ): int {
	return 'contact' === $role ? (int) get_option( 'my_agency_contact_page' ) : $page_id;
}, 10, 2 );

lanternwp_store_phone

Theme, since 0.5.0. Filters the store's phone, as customers should dial it, such as (720) 555-0148, which the contact pattern and the phone field of the lanternwp/store bindings show. The default, '', means none, and the phone is left out; WooCommerce keeps no phone number. Companion returns its Store phone in WooCommerce → Settings → General.

add_filter( 'lanternwp_store_phone', fn () => '(720) 555-0148' );

lanternwp_story_products

Theme, since 0.7.0. Filters the products a post sells, given the post's id: a list of product ids in order, [] by default. The theme shows them in Shop the story panels at the end of the post, and the first one the store shows on a journal card with a panel (the home page's Featured post and latest posts). It keeps the products the store shows (published, visible in the catalog, in stock unless Hide out of stock items lets sold-out products show), each once, four at most; a post that asks for a password sells none. Companion returns the products chosen in the post's Shop the story setting, the lanternwp_story_products post meta.

add_filter( 'lanternwp_story_products', function ( array $product_ids, int $post_id ): array {
	return $product_ids ?: array_map( 'intval', (array) get_post_meta( $post_id, 'my_agency_products', true ) );
}, 10, 2 );

lanternwp_demo_server

Companion, since 0.1.0. Filters the lanternwp.com that Companion asks: https://lanternwp.com by default. It is the demo store the Appearance → LanternWP → Demos screen lists and imports demos from. Return the address of another store that serves the same API, such as a copy of lanternwp.com for development. A value that is not a valid URL is ignored. wp lanternwp demo import does not use it; it takes --server instead (WP-CLI).

add_filter( 'lanternwp_demo_server', fn () => 'https://demos.example.test' );

lanternwp_product_posts_template

Companion, since 0.7.0. Filters the cards of the Posts with this Product block (lanternwp/product-posts) on a product page: the serialized Post Template block of its Query, given how many posts it shows (1 to 3) and the class the Post Template must carry. The default is core's featured image, title and date in a grid of three. The block finds its own Query by that class to give it the posts, so a Post Template without it lists the latest posts instead. The LanternWP theme returns its journal cards.

add_filter( 'lanternwp_product_posts_template', function ( string $template, int $count, string $class_name ): string {
	return '<!-- wp:post-template {"className":"' . $class_name . '"} --><!-- wp:post-title {"isLink":true} /--><!-- /wp:post-template -->';
}, 10, 3 );