auth_redirect example


    public function setup_theme() {
        global $pagenow;

        // Check permissions for customize.php access since this method is called before customize.php can run any code.         if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) {
            if ( ! is_user_logged_in() ) {
                auth_redirect();
            } else {
                wp_die(
                    '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                    '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
                    403
                );
            }
            return;
        }

        // If a changeset was provided is invalid.

            /** This action is documented in wp-admin/network/upgrade.php */
            do_action( 'after_mu_upgrade', $response );
            unset( $response );
        }
        unset( $c );
    }
}

require_once ABSPATH . 'wp-admin/includes/admin.php';

auth_redirect();

// Schedule Trash collection. if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) {
    wp_schedule_event( time(), 'daily', 'wp_scheduled_delete' );
}

// Schedule transient cleanup. if ( ! wp_next_scheduled( 'delete_expired_transients' ) && ! wp_installing() ) {
    wp_schedule_event( time(), 'daily', 'delete_expired_transients' );
}

Home | Imprint | This part of the site doesn't use cookies.