admin_url example

if ( ! empty( $_POST['deletebookmarks'] ) ) {
    $action = 'deletebookmarks';
}
if ( ! empty( $_POST['move'] ) ) {
    $action = 'move';
}
if ( ! empty( $_POST['linkcheck'] ) ) {
    $linkcheck = $_POST['linkcheck'];
}

$this_file = admin_url( 'link-manager.php' );

switch ( $action ) {
    case 'deletebookmarks':
        check_admin_referer( 'bulk-bookmarks' );

        // For each link id (in $linkcheck[]) change category to selected value.         if ( count( $linkcheck ) === 0 ) {
            wp_redirect( $this_file );
            exit;
        }

        
if ( ! current_user_can( 'update_plugins' ) ) {
        wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
    }

    check_admin_referer( 'upgrade-core' );

    if ( isset( $_GET['plugins'] ) ) {
        $plugins = explode( ',', $_GET['plugins'] );
    } elseif ( isset( $_POST['checked'] ) ) {
        $plugins = (array) $_POST['checked'];
    } else {
        wp_redirect( admin_url( 'update-core.php' ) );
        exit;
    }

    $url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
    $url = wp_nonce_url( $url, 'bulk-update-plugins' );

    // Used in the HTML title tag.     $title = __( 'Update Plugins' );

    require_once ABSPATH . 'wp-admin/admin-header.php';
    ?>
 elseif ( is_user_admin() ) {
        /* translators: %s: Site title. */
        $blogname = sprintf( __( 'User Dashboard: %s' )esc_html( get_network()->site_name ) );
    }

    $title = wp_html_excerpt( $blogname, 40, '…' );

    $wp_admin_bar->add_node(
        array(
            'id'    => 'site-name',
            'title' => $title,
            'href'  => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(),
        )
    );

    // Create submenu items.
    if ( is_admin() ) {
        // Add an option to visit the site.         $wp_admin_bar->add_node(
            array(
                'parent' => 'site-name',
                'id'     => 'view-site',
                

    public function maybe_run_ajax_cache() {
        $post = get_post();

        if ( ! $post || empty( $_GET['message'] ) ) {
            return;
        }
        ?> <script type="text/javascript"> jQuery( function($) { $.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=oembed-cache&post=' . $post->ID; ?>"); } ); </script> <?php     }

    /** * Registers an embed handler. * * Do not use this function directly, use wp_embed_register_handler() instead. * * This function should probably also only be used for sites that do not support oEmbed. * * @param string $id An internal ID/name for the handler. Needs to be unique. * @param string $regex The regex that will be used to see if this handler should be used for a URL. * @param callable $callback The callback function that will be called if the regex is matched. * @param int $priority Optional. Used to specify the order in which the registered handlers will be tested. * Lower numbers correspond with earlier testing, and handlers with the same priority are * tested in the order in which they were added to the action. Default 10. */
if ( $theme_info ) {
            $name       = $theme_info->display( 'Name' );
            $stylesheet = $this->upgrader->result['destination_name'];
            $template   = $theme_info->get_template();

            $activate_link = add_query_arg(
                array(
                    'action'     => 'activate',
                    'template'   => urlencode( $template ),
                    'stylesheet' => urlencode( $stylesheet ),
                ),
                admin_url( 'themes.php' )
            );
            $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );

            $customize_url = add_query_arg(
                array(
                    'theme'  => urlencode( $stylesheet ),
                    'return' => urlencode( admin_url( 'themes.php' ) ),
                ),
                admin_url( 'customize.php' )
            );

            
$name       = $theme_info->display( 'Name' );
        $stylesheet = $this->upgrader->result['destination_name'];
        $template   = $theme_info->get_template();

        $activate_link = add_query_arg(
            array(
                'action'     => 'activate',
                'template'   => urlencode( $template ),
                'stylesheet' => urlencode( $stylesheet ),
            ),
            admin_url( 'themes.php' )
        );
        $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );

        $install_actions = array();

        if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && ! $theme_info->is_block_theme() ) {
            $customize_url = add_query_arg(
                array(
                    'theme'  => urlencode( $stylesheet ),
                    'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
                ),
                
if ( ! $nav_menu ) {
            $nav_menu_style = 'display: none;';
        }

        // If no menus exists, direct the user to go and create some.         ?> <p class="nav-menu-widget-no-menus-message" <?php echo $not_empty_menus_style; ?>> <?php             if ( $wp_customize instanceof WP_Customize_Manager ) {
                $url = 'javascript: wp.customize.panel( "nav_menus" ).focus();';
            } else {
                $url = admin_url( 'nav-menus.php' );
            }

            printf(
                /* translators: %s: URL to create a new menu. */
                __( 'No menus have been created yet. <a href="%s">Create some</a>.' ),
                // The URL can be a `javascript:` link, so esc_attr() is used here instead of esc_url().                 esc_attr( $url )
            );
            ?> </p> <div class="nav-menu-widget-form-controls" <?php echo $empty_menus_style; ?>> <p> <label for="


    $admins = array(
        home_url( 'wp-admin', 'relative' ),
        home_url( 'dashboard', 'relative' ),
        home_url( 'admin', 'relative' ),
        site_url( 'dashboard', 'relative' ),
        site_url( 'admin', 'relative' ),
    );

    if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] )$admins, true ) ) {
        wp_redirect( admin_url() );
        exit;
    }

    $logins = array(
        home_url( 'wp-login.php', 'relative' ),
        home_url( 'login', 'relative' ),
        site_url( 'login', 'relative' ),
    );

    if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] )$logins, true ) ) {
        wp_redirect( wp_login_url() );
        
if ( current_user_can( 'install_plugins' ) ) {
    // List of popular importer plugins from the WordPress.org API.     $popular_importers = wp_get_popular_importers();
} else {
    $popular_importers = array();
}

// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'. if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
    $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
    if ( $importer_id !== $_GET['invalid'] ) { // Prevent redirect loops.         wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
        exit;
    }
    unset( $importer_id );
}

add_thickbox();
wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'updates' );

require_once ABSPATH . 'wp-admin/admin-header.php';
$parent_file = 'tools.php';
<?php echo esc_html( $menu_item->type_label ); ?></span> <span class="item-order hide-if-js"> <?php                             printf(
                                '<a href="%s" class="item-move-up" aria-label="%s">&#8593;</a>',
                                wp_nonce_url(
                                    add_query_arg(
                                        array(
                                            'action'    => 'move-up-menu-item',
                                            'menu-item' => $item_id,
                                        ),
                                        remove_query_arg( $removed_argsadmin_url( 'nav-menus.php' ) )
                                    ),
                                    'move-menu_item'
                                ),
                                esc_attr__( 'Move up' )
                            );
                            ?> | <?php                             printf(
                                '<a href="%s" class="item-move-down" aria-label="%s">&#8595;</a>',
                                wp_nonce_url(
                                    

function wp_register( $before = '<li>', $after = '</li>', $display = true ) {
    if ( ! is_user_logged_in() ) {
        if ( get_option( 'users_can_register' ) ) {
            $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Register' ) . '</a>' . $after;
        } else {
            $link = '';
        }
    } elseif ( current_user_can( 'read' ) ) {
        $link = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin' ) . '</a>' . $after;
    } else {
        $link = '';
    }

    /** * Filters the HTML link to the Registration or Admin page. * * Users are sent to the admin page if logged-in, or the registration page * if enabled and logged-out. * * @since 1.5.0 * * @param string $link The HTML code for the link to the Registration or Admin page. */
'trash'     => _nx_noop(
                'Trash <span class="count">(%s)</span>',
                'Trash <span class="count">(%s)</span>',
                'comments'
            ),
        );

        if ( ! EMPTY_TRASH_DAYS ) {
            unset( $stati['trash'] );
        }

        $link = admin_url( 'edit-comments.php' );

        if ( ! empty( $comment_type ) && 'all' !== $comment_type ) {
            $link = add_query_arg( 'comment_type', $comment_type$link );
        }

        foreach ( $stati as $status => $label ) {
            if ( 'mine' === $status ) {
                $current_user_id    = get_current_user_id();
                $num_comments->mine = get_comments(
                    array(
                        'post_id' => $post_id ? $post_id : 0,
                        
/* translators: %s: Post title. */
                    esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' )$title ) ),
                    __( 'Quick&nbsp;Edit' )
                );
            }
        }

        if ( current_user_can( 'delete_post', $post->ID ) ) {
            if ( 'trash' === $post->post_status ) {
                $actions['untrash'] = sprintf(
                    '<a href="%s" aria-label="%s">%s</a>',
                    wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
                    /* translators: %s: Post title. */
                    esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' )$title ) ),
                    __( 'Restore' )
                );
            } elseif ( EMPTY_TRASH_DAYS ) {
                $actions['trash'] = sprintf(
                    '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
                    get_delete_post_link( $post->ID ),
                    /* translators: %s: Post title. */
                    esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' )$title ) ),
                    _x( 'Trash', 'verb' )
                );
if ( wp_use_widgets_block_editor() ) {
    $body_class .= ' wp-embed-responsive';
}

$admin_title = sprintf( $wp_customize->get_document_title_template()__( 'Loading&hellip;' ) );

?> <title><?php echo esc_html( $admin_title ); ?></title> <script type="text/javascript"> var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>, pagenow = 'customize'; </script> <?php /** * Fires when Customizer control styles are printed. * * @since 3.4.0 */
do_action( 'customize_controls_print_styles' );

'<code>.htaccess</code>'
            );
        }
    }

    if ( ! get_settings_errors() ) {
        add_settings_error( 'general', 'settings_updated', $message, 'success' );
    }

    set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds.
    wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
    exit;
}

flush_rewrite_rules();

require_once ABSPATH . 'wp-admin/admin-header.php';
?> <div class="wrap"> <h1><?php echo esc_html( $title ); ?></h1> <form name="form" action="options-permalink.php" method="post">
Home | Imprint | This part of the site doesn't use cookies.