I'm creating a page using:

 * Add the admin menu item, under Appearance.
public function addAdminMenu() {
    $page = add_theme_page(
        esc_html__( 'Setup' ),
        esc_html__( 'Setup' ),
        'manage_options', 'setup_page',
        [ $this, 'setupPageContent' ]

    add_action( 'load-' . $page, [$this, 'localizeSetupScreenJS'] );
    add_action( 'load-' . $page, [$this, 'enqueueSetupScreenCSS'] );

The function addAdminMenu is called:

add_action( 'admin_menu', [$this, 'addAdminMenu' ]);

Which adds a nice entry under "Appearance" for my page. As such, my page's link is:

I saw some plugins, WooCommerce especially, after they've been activated, they re-direct / ask you to go to a page where you can tell they're still in the back-end, but the side menu or any other menus besides their content doesn't show.

I'm looking for a hook like before_output_wordpress_dashboard.


I think you're looking for the register_activation_hook()

More info here.

And here.

Greetz, Bjorn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.