get_sample_permalink_html example

/** * Handles retrieving a sample permalink via AJAX. * * @since 3.1.0 */
function wp_ajax_sample_permalink() {
    check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
    $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
    $title   = isset( $_POST['new_title'] ) ? $_POST['new_title'] : '';
    $slug    = isset( $_POST['new_slug'] ) ? $_POST['new_slug'] : null;
    wp_die( get_sample_permalink_html( $post_id$title$slug ) );
}

/** * Handles Quick Edit saving a post from a list table via AJAX. * * @since 3.1.0 * * @global string $mode List table view mode. */
function wp_ajax_inline_save() {
    global $mode;

    

    do_action( 'edit_form_before_permalink', $post );
    ?> <div class="inside"> <?php     if ( $viewable ) :
        $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : '';

        // As of 4.4, the Get Shortlink button is hidden by default.         if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
            $shortlink = wp_get_shortlink( $post->ID, 'post' );

            if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
                $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
                    '<button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' .
                    __( 'Get Shortlink' ) .
                    '</button>';
            }
        }
Home | Imprint | This part of the site doesn't use cookies.