get_nonces example


    if ( $missed_schedule ) {
        /* * Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`. * * Because WP_Customize_Manager is not instantiated for customize.php with the `settings_previewed=false` * argument, settings cannot be reliably saved. Some logic short-circuits if the current value is the * same as the value being saved. This is particularly true for options via `update_option()`. * * By opening an Ajax request, this is avoided and the changeset is published. See #39221. */
        $nonces       = $wp_customize->get_nonces();
        $request_args = array(
            'nonce'                      => $nonces['save'],
            'customize_changeset_uuid'   => $wp_customize->changeset_uuid(),
            'wp_customize'               => 'on',
            'customize_changeset_status' => 'publish',
        );
        ob_start();
        ?> <?php wp_print_scripts( array( 'wp-util' ) ); ?> <script> wp.ajax.post( 'customize_save', <?php echo wp_json_encode( $request_args ); ?> ); </script>
'url'               => array(
                'self'          => $self_url,
                'allowed'       => array_map( 'sanitize_url', $this->get_allowed_urls() ),
                'allowedHosts'  => array_unique( $allowed_hosts ),
                'isCrossDomain' => $this->is_cross_domain(),
            ),
            'channel'           => $this->messenger_channel,
            'activePanels'      => array(),
            'activeSections'    => array(),
            'activeControls'    => array(),
            'settingValidities' => $exported_setting_validities,
            'nonce'             => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
            'l10n'              => $l10n,
            '_dirty'            => array_keys( $post_values ),
        );

        foreach ( $this->panels as $panel_id => $panel ) {
            if ( $panel->check_capabilities() ) {
                $settings['activePanels'][ $panel_id ] = $panel->active();
                foreach ( $panel->sections as $section_id => $section ) {
                    if ( $section->check_capabilities() ) {
                        $settings['activeSections'][ $section_id ] = $section->active();
                    }
                }
Home | Imprint | This part of the site doesn't use cookies.