ap_post_edit_link( mixed $_post )

Description #

Return edit link for question and answer.

Parameters #

  • $_post
    mixed (Required) Post.

Changelog #

VersionDescription
2.0.1Introduced.

Source #

File: includes/functions.php

function ap_post_edit_link( $_post ) {
	$_post     = ap_get_post( $_post );
	$nonce     = wp_create_nonce( 'edit-post-' . $_post->ID );
	$base_page = 'question' === $_post->post_type ? ap_get_link_to( 'ask' ) : ap_get_link_to( 'edit' );
	$edit_link = add_query_arg(
		array(
			'id'      => $_post->ID,
			'__nonce' => $nonce,
		),
		$base_page
	);

	/**
	 * Allows filtering post edit link.
	 *
	 * @param string $edit_link Url to edit post.
	 * @since unknown
	 */
	return apply_filters( 'ap_post_edit_link', $edit_link );
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment