wp_removable_query_args example

<div class="wrap"> <h1 class="wp-heading-inline"><?php esc_html_e( 'Menus' ); ?></h1> <?php     if ( current_user_can( 'customize' ) ) :
        $focus = $locations_screen ? array( 'section' => 'menu_locations' ) : array( 'panel' => 'nav_menus' );
        printf(
            ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
            esc_url(
                add_query_arg(
                    array(
                        array( 'autofocus' => $focus ),
                        'return' => urlencode( remove_query_arg( wp_removable_query_args()wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
                    ),
                    admin_url( 'customize.php' )
                )
            ),
            __( 'Manage with Live Preview' )
        );
    endif;

    $nav_tab_active_class = '';
    $nav_aria_current     = '';

    
$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' );
}


/** * Removes single-use URL parameters and create canonical link based on new URL. * * Removes specific query string parameters from a URL, create the canonical link, * put it in the admin header, and change the current URL to match. * * @since 4.2.0 */
function wp_admin_canonical_url() {
    $removable_query_args = wp_removable_query_args();

    if ( empty( $removable_query_args ) ) {
        return;
    }

    // Ensure we're using an absolute URL.     $current_url  = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    $filtered_url = remove_query_arg( $removable_query_args$current_url );
    ?> <link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" /> <script> if ( window.history.replaceState ) { window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash ); } </script>
/** * Sets URL to link the user to when closing the Customizer. * * URL is validated. * * @since 4.4.0 * * @param string $return_url URL for return link. */
    public function set_return_url( $return_url ) {
        $return_url       = sanitize_url( $return_url );
        $return_url       = remove_query_arg( wp_removable_query_args()$return_url );
        $return_url       = wp_validate_redirect( $return_url );
        $this->return_url = $return_url;
    }

    /** * Gets URL to link the user to when closing the Customizer. * * @since 4.4.0 * * @global array $_registered_pages * * @return string URL for link to close Customizer. */
if ( $is_block_theme && $can_edit_theme_options ) {
            $customize_action = admin_url( 'site-editor.php' );
            if ( $current_theme !== $slug ) {
                $customize_action = add_query_arg( 'wp_theme_preview', $slug$customize_action );
            }
        } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) {
            $customize_action = wp_customize_url( $slug );
        }
        if ( null !== $customize_action ) {
            $customize_action = add_query_arg(
                array(
                    'return' => urlencode( sanitize_url( remove_query_arg( wp_removable_query_args()wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ),
                ),
                $customize_action
            );
            $customize_action = esc_url( $customize_action );
        }

        $update_requires_wp  = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null;
        $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null;

        $auto_update        = in_array( $slug$auto_updates, true );
        $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update';

        
if ( 'top' === $which && $total_pages > 1 ) {
            $this->screen->render_screen_reader_content( 'heading_pagination' );
        }

        $output = '<span class="displaying-num">' . sprintf(
            /* translators: %s: Number of items. */
            _n( '%s item', '%s items', $total_items ),
            number_format_i18n( $total_items )
        ) . '</span>';

        $current              = $this->get_pagenum();
        $removable_query_args = wp_removable_query_args();

        $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );

        $current_url = remove_query_arg( $removable_query_args$current_url );

        $page_links = array();

        $total_pages_before = '<span class="paging-input">';
        $total_pages_after  = '</span></span>';

        $disable_first = false;
        
?> </h1> <?php if ( current_user_can( 'customize' ) ) {
    printf(
        ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
        esc_url(
            add_query_arg(
                array(
                    array( 'autofocus' => array( 'panel' => 'widgets' ) ),
                    'return' => urlencode( remove_query_arg( wp_removable_query_args()wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
                ),
                admin_url( 'customize.php' )
            )
        ),
        __( 'Manage with Live Preview' )
    );
}

$nonce = wp_create_nonce( 'widgets-access' );
?> <div class="widget-access-link"> <a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=
Home | Imprint | This part of the site doesn't use cookies.