wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_ajax_sample_permalink › WordPress Function

Seit3.1.0
Veraltetn/v
› wp_ajax_sample_permalink ( Keine Parameter )
Definiert in:
Codex:

Handles retrieving a sample permalink via AJAX.



Quellcode

function wp_ajax_sample_permalink() {
	check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
	$post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
	if ( ! $post_id ) {
		// Bypass call to get_sample_permalink_html() for unspecified post ID.
		wp_die( '' );
	}
	if ( ! current_user_can( 'edit_post', $post_id ) ) {
		wp_die( -1 );
	}
	$title = $_POST['new_title'] ?? '';
	$slug  = $_POST['new_slug'] ?? null;
	wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
}