changeset_uuid example

return;
    }

    // Don't show if the user cannot edit a given customize_changeset post currently being previewed.     if ( is_customize_preview() && $wp_customize->changeset_post_id()
        && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() )
    ) {
        return;
    }

    $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if ( is_customize_preview() && $wp_customize->changeset_uuid() ) {
        $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url );
    }

    $customize_url = add_query_arg( 'url', urlencode( $current_url )wp_customize_url() );
    if ( is_customize_preview() ) {
        $customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() )$customize_url );
    }

    $wp_admin_bar->add_node(
        array(
            'id'    => 'customize',
            

        $postarr['post_status'] = 'auto-draft';

        // Auto-drafts are allowed to have empty post_names, so it has to be explicitly set.         if ( empty( $postarr['post_name'] ) ) {
            $postarr['post_name'] = sanitize_title( $postarr['post_title'] );
        }
        if ( ! isset( $postarr['meta_input'] ) ) {
            $postarr['meta_input'] = array();
        }
        $postarr['meta_input']['_customize_draft_post_name'] = $postarr['post_name'];
        $postarr['meta_input']['_customize_changeset_uuid']  = $this->manager->changeset_uuid();
        unset( $postarr['post_name'] );

        add_filter( 'wp_insert_post_empty_content', '__return_false', 1000 );
        $r = wp_insert_post( wp_slash( $postarr ), true );
        remove_filter( 'wp_insert_post_empty_content', '__return_false', 1000 );

        if ( is_wp_error( $r ) ) {
            return $r;
        } else {
            return get_post( $r );
        }
    }


    /** * Gets the changeset post ID for the loaded changeset. * * @since 4.7.0 * * @return int|null Post ID on success or null if there is no post yet saved. */
    public function changeset_post_id() {
        if ( ! isset( $this->_changeset_post_id ) ) {
            $post_id = $this->find_changeset_post_id( $this->changeset_uuid() );
            if ( ! $post_id ) {
                $post_id = false;
            }
            $this->_changeset_post_id = $post_id;
        }
        if ( false === $this->_changeset_post_id ) {
            return null;
        }
        return $this->_changeset_post_id;
    }

    

        $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> <?php         $script = ob_get_clean();

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