remove_query_arg example

if ( wp_get_referer() && ! $noredir && ! str_contains( wp_get_referer(), 'comment.php' ) ) {
            $redir = wp_get_referer();
        } elseif ( wp_get_original_referer() && ! $noredir ) {
            $redir = wp_get_original_referer();
        } elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
            $redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
        } else {
            $redir = admin_url( 'edit-comments.php' );
        }

        $redir = remove_query_arg( array( 'spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved' )$redir );

        switch ( $action ) {
            case 'deletecomment':
                wp_delete_comment( $comment );
                $redir = add_query_arg( array( 'deleted' => '1' )$redir );
                break;
            case 'trashcomment':
                wp_trash_comment( $comment );
                $redir = add_query_arg(
                    array(
                        'trashed' => '1',
                        
get_current_screen()->set_screen_reader_content(
    array(
        'heading_views'      => __( 'Filter users list' ),
        'heading_pagination' => __( 'Users list navigation' ),
        'heading_list'       => __( 'Users list' ),
    )
);

if ( empty( $_REQUEST ) ) {
    $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
} elseif ( isset( $_REQUEST['wp_http_referer'] ) ) {
    $redirect = remove_query_arg( array( 'wp_http_referer', 'updated', 'delete_count' )wp_unslash( $_REQUEST['wp_http_referer'] ) );
    $referer  = '<input type="hidden" name="wp_http_referer" value="' . esc_attr( $redirect ) . '" />';
} else {
    $redirect = 'users.php';
    $referer  = '';
}

$update = '';

switch ( $wp_list_table->current_action() ) {

    /* Bulk Dropdown menu Role changes */
    
$redirect_to = wp_get_referer();
                    $blogs       = (array) $_POST['allblogs'];

                    /** This action is documented in wp-admin/network/site-themes.php */
                    $redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to$doaction$blogs$id ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
                    wp_safe_redirect( $redirect_to );
                    exit;
                }
            } else {
                // Process query defined by WP_MS_Site_List_Table::extra_table_nav().                 $location = remove_query_arg(
                    array( '_wp_http_referer', '_wpnonce' ),
                    add_query_arg( $_POSTnetwork_admin_url( 'sites.php' ) )
                );

                wp_redirect( $location );
                exit;
            }

            break;

        case 'archiveblog':
        
$submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
}

if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ) {
    $submenu['themes.php'][6] = array(
        __( 'Template Parts' ),
        'edit_theme_options',
        'site-editor.php?path=/wp_template_part/all',
    );
}

$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args()wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );

// Hide Customize link on block themes unless a plugin or theme // is using 'customize_register' to add a setting. if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
    $position = ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) ? 7 : 6;

    $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
}

if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
    $submenu['themes.php'][10] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
}
exit;
    }

    $approved   = 0;
    $unapproved = 0;
    $spammed    = 0;
    $unspammed  = 0;
    $trashed    = 0;
    $untrashed  = 0;
    $deleted    = 0;

    $redirect_to = remove_query_arg(
        array(
            'trashed',
            'untrashed',
            'deleted',
            'spammed',
            'unspammed',
            'approved',
            'unapproved',
            'ids',
        ),
        wp_get_referer()
    );
array(
        'heading_pagination' => $tax->labels->items_list_navigation,
        'heading_list'       => $tax->labels->items_list,
    )
);

$location = false;
$referer  = wp_get_referer();
if ( ! $referer ) { // For POST requests.     $referer = wp_unslash( $_SERVER['REQUEST_URI'] );
}
$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' )$referer );
switch ( $wp_list_table->current_action() ) {

    case 'add-tag':
        check_admin_referer( 'add-tag', '_wpnonce_add-tag' );

        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
                403
            );
        }
foreach ( $dashboard_widgets as $widget_id ) {
        $name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __( 'View all' ) . '</a>';
        wp_add_dashboard_widget( $widget_id$name$wp_registered_widgets[ $widget_id ]['callback']$wp_registered_widget_controls[ $widget_id ]['callback'] );
    }

    if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
        check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
        ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.         wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
        ob_end_clean();
        wp_redirect( remove_query_arg( 'edit' ) );
        exit;
    }

    /** This action is documented in wp-admin/includes/meta-boxes.php */
    do_action( 'do_meta_boxes', $screen->id, 'normal', '' );

    /** This action is documented in wp-admin/includes/meta-boxes.php */
    do_action( 'do_meta_boxes', $screen->id, 'side', '' );
}

/** * Adds a new dashboard widget. * * @since 2.7.0 * @since 5.6.0 The `$context` and `$priority` parameters were added. * * @global callable[] $wp_dashboard_control_callbacks * * @param string $widget_id Widget ID (used in the 'id' attribute for the widget). * @param string $widget_name Title of the widget. * @param callable $callback Function that fills the widget with the desired content. * The function should echo its output. * @param callable $control_callback Optional. Function that outputs controls for the widget. Default null. * @param array $callback_args Optional. Data that should be set as the $args property of the widget array * (which is the second parameter passed to your callback). Default null. * @param string $context Optional. The context within the screen where the box should display. * Accepts 'normal', 'side', 'column3', or 'column4'. Default 'normal'. * @param string $priority Optional. The priority within the context where the box should show. * Accepts 'high', 'core', 'default', or 'low'. Default 'core'. */
if ( ! Akismet::get_api_key() ) {
                $link = self::get_page_url();
                $classes[] = 'ajax-disabled';
            }
        }

        echo '<a class="' . esc_attr( implode( ' ', $classes ) ) . '"' .
                ( ! empty( $link ) ? ' href="' . esc_url( $link ) . '"' : '' ) .
                /* translators: The placeholder is for showing how much of the process has completed, as a percent. e.g., "Checking for Spam (40%)" */
                ' data-progress-label="' . esc_attr( __( 'Checking for Spam (%1$s%)', 'akismet' ) ) . '" data-success-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_error' )add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '" data-failure-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_complete' )add_query_arg( array( 'akismet_recheck_error' => 1 ) ) ) ) . '" data-pending-comment-count="' . esc_attr( $comments_count->moderated ) . '" data-nonce="' . esc_attr( wp_create_nonce( 'akismet_check_for_spam' ) ) . '" ' . ( ! in_array( 'ajax-disabled', $classes ) ? 'onclick="return false;"' : '' ) . ' >' . esc_html__('Check for Spam', 'akismet') . '</a>';
        echo '<span class="checkforspam-spinner"></span>';
    }

    public static function recheck_queue() {
        global $wpdb;

        
'title'   => __( 'Overview' ),
        'content' => $profile_help,
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/users-your-profile-screen/">Documentation on User Profiles</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);

$wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' )$wp_http_referer );

$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );

/** * Filters whether to allow administrators on Multisite to edit every user. * * Enabling the user editing form via this filter also hinges on the user holding * the 'manage_network_users' cap, and the logged-in user not matching the user * profile open for editing. * * The filter was introduced to replace the EDIT_ANY_USER constant. * * @since 3.0.0 * * @param bool $allow Whether to allow editing of any user. Default true. */
$value = apply_filters( "set_screen_option_{$option}", $screen_option$option$value );

            if ( false === $value ) {
                return;
            }

            break;
    }

    update_user_meta( $user->ID, $option$value );

    $url = remove_query_arg( array( 'pagenum', 'apage', 'paged' )wp_get_referer() );

    if ( isset( $_POST['mode'] ) ) {
        $url = add_query_arg( array( 'mode' => $_POST['mode'] )$url );
    }

    wp_safe_redirect( $url );
    exit;
}

/** * Checks if rewrite rule for WordPress already exists in the IIS 7+ configuration file. * * @since 2.8.0 * * @param string $filename The file path to the configuration file. * @return bool */
 else {
    $parent_file   = 'edit.php';
    $submenu_file  = 'edit.php';
    $post_new_file = 'post-new.php';
}

$doaction = $wp_list_table->current_action();

if ( $doaction ) {
    check_admin_referer( 'bulk-posts' );

    $sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'locked', 'ids' )wp_get_referer() );
    if ( ! $sendback ) {
        $sendback = admin_url( $parent_file );
    }
    $sendback = add_query_arg( 'paged', $pagenum$sendback );
    if ( str_contains( $sendback, 'post.php' ) ) {
        $sendback = admin_url( $post_new_file );
    }

    $post_ids = array();

    if ( 'delete_all' === $doaction ) {
        

function _post_format_link( $link$term$taxonomy ) {
    global $wp_rewrite;
    if ( 'post_format' !== $taxonomy ) {
        return $link;
    }
    if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) {
        return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug )$link );
    } else {
        $link = remove_query_arg( 'post_format', $link );
        return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug )$link );
    }
}

/** * Remove the post format prefix from the name property of the term object created by get_term(). * * @access private * @since 3.1.0 * * @param object $term * @return object */


if ( is_multisite() && ! is_network_admin() ) {
    wp_redirect( network_admin_url( 'plugin-install.php' ) );
    exit;
}

$wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
    $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );

    if ( ! empty( $_REQUEST['paged'] ) ) {
        $location = add_query_arg( 'paged', (int) $_REQUEST['paged']$location );
    }

    wp_redirect( $location );
    exit;
}

$wp_list_table->prepare_items();

break;

    case 'resetpass':
    case 'rp':
        list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
        $rp_cookie       = 'wp-resetpass-' . COOKIEHASH;

        if ( isset( $_GET['key'] ) && isset( $_GET['login'] ) ) {
            $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] )wp_unslash( $_GET['key'] ) );
            setcookie( $rp_cookie$value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );

            wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
            exit;
        }

        if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
            list( $rp_login$rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );

            $user = check_password_reset_key( $rp_key$rp_login );

            if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key$_POST['rp_key'] ) ) {
                $user = false;
            }
        }
<?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(
                                    
Home | Imprint | This part of the site doesn't use cookies.