Skip to content
Gaurav TiwariDocs

Hooks, Filters and Shortcodes

Version 1.4.6 Updated October 19, 2026

MailerHive keeps its settings screen short and leaves the edge cases to code. If you need a different set of share networks, extra lists for some issues or a badge on certain titles, a filter does it without touching the plugin.

Put these snippets in a small custom plugin or your snippets plugin, not in the theme. Theme isolation keeps your theme’s code off MailerHive pages.

Filters

FilterArgumentsWhat it changes
mailerhive_share_networksarray $nets, WP_Post $postThe share bar. Each entry is key => [label, icon, url]. Return an empty array to hide the bar
mailerhive_draft_list_idsarray $list_ids, WP_Post $postThe MailerPress lists an issue’s draft goes to
mailerhive_mirror_list_idsarray $list_idsThe lists that make a sent campaign eligible for mirroring
mailerhive_issue_badgestring $html, WP_Post $postMarkup after an issue title in the archive, on the newsletter page and in [mailerhive_issues]
mailerhive_issue_bodynull, WP_Post $postReturn HTML to replace an issue’s body on its page
mailerhive_theme_rootsarray $rootsThe folders theme isolation treats as your theme

Actions

ActionArgumentsWhen it fires
mailerhive_issue_mirroredint $post_id, array $list_idsAfter a MailerPress campaign becomes an issue, before its content is saved
mailerhive_issue_meta_boxWP_Post $postInside the Issue details box, to add your own fields
mailerhive_issue_meta_saveint $post_idWhen the Issue details box is saved
mailerhive_landing_after_herononeOn the newsletter page, after the signup card

Change the Share Networks

Share URLs accept http, https and mailto addresses. Icons come from MailerHive’s assets/icons folder by name, such as link, mail or news.

add_filter( 'mailerhive_share_networks', function ( array $nets, WP_Post $post ): array {
	unset( $nets['whatsapp'], $nets['threads'] );
	$nets['hackernews'] = array(
		'Hacker News',
		'news',
		'https://news.ycombinator.com/submitlink?u=' . rawurlencode( get_permalink( $post ) ) . '&t=' . rawurlencode( get_the_title( $post ) ),
	);
	return $nets;
}, 10, 2 );

Send Some Issues to Another List

add_filter( 'mailerhive_draft_list_ids', function ( array $lists, WP_Post $post ): array {
	if ( has_term( 'announcements', 'post_tag', $post ) ) {
		$lists[] = 12; // a MailerPress list ID
	}
	return $lists;
}, 10, 2 );

Issues don’t have tags by default, so adapt the condition to whatever marks those issues on your site, such as a custom field.

Add a Badge to Some Titles

add_filter( 'mailerhive_issue_badge', function ( string $html, WP_Post $post ): string {
	if ( get_post_meta( $post->ID, 'featured_issue', true ) ) {
		$html .= ' <span class="my-badge">Featured</span>';
	}
	return $html;
}, 10, 2 );

Shortcodes

ShortcodeAttributesOutput
[mailerhive_issues]limit, default 6The latest issues as a list
[mailerhive_plans]tier, headingPaid plan cards. Needs the paid module
[mailerhive_account]noneThe reader’s paid access, or the reading link form. Needs the paid module

Reading links and the account box covers the 2 paid shortcodes in detail.

Constants

MAILERHIVE_VERSION, MAILERHIVE_FILE, MAILERHIVE_DIR and MAILERHIVE_URL are defined when the plugin loads. Check defined( 'MAILERHIVE_VERSION' ) before calling MailerHive from another plugin.

Share

Was this helpful?

Still stuck? Open a support ticket