Skip to main content

Link into Benecaster’s admin on the right show

Free Beginner

The admin opens on the site’s first show unless the link names one. Any per-show link an add-on sends, such as a digest email, a notice or a Slack message, should name it, or on a multi-show site the reader lands on the wrong show. benecaster_get_admin_url() builds the link.

The route must be one the admin renders (/episodes, /subscribers, /analytics, /settings/notifications, an add-on screen’s own route). An unknown route opens an empty pane, not an error. An id that is not a published show opens the first show, silently. The show_id is removed from the address bar once read, so the switcher behaves normally afterwards.

Code

<?php
$url = benecaster_get_admin_url( '/analytics', $show_id );
// …/wp-admin/admin.php?page=benecaster&show_id=12#/analytics
printf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Manage digest preferences', 'my-addon' ) );

View on GitHub →

Need this built rather than just documented? See our services →