wp_ajax_get_permalink() WordPress Function

The wp_ajax_get_permalink() function is used to retrieve the permalink for a given post ID. This is useful for creating links to specific posts in the WordPress admin area.

wp_ajax_get_permalink() #

Ajax handler to retrieve a permalink.


Source

File: wp-admin/includes/ajax-actions.php

function wp_ajax_get_permalink() {
	check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
	$post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
	wp_die( get_preview_post_link( $post_id ) );
}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More