edit_post_link

Sponsored Link

ユーザーがログインして、記事を編集する権限がある場合、現在の記事を編集するリンクを表示します。これは、ループ内にある必要があります。

get_edit_post_linkは、URLを取得するために使用します。

Sponsored Link

Displays a link to edit the current post, if a user is logged in and allowed to edit the post. It must be within The Loop.

Use get_edit_post_link to retrieve the url.

edit_post_linkのテンプレートタグ使用方法

<?php edit_post_link( $link, $before, $after, $id ); ?> 

edit_post_linkのパラメーター

link

(string) (optional) リンクテキストです。

(string) (optional) The link text.

Default: __(‘Edit This’)

before

(string) (optional) リンクテキストの前に配置するテキストです。

(string) (optional) Text to put before the link text.

Default: None

after

(string) (optional) リンクテキストの後に配置するテキストです。

(string) (optional) Text to put after the link text.

Default: None

id

(integer) (optional) 記事IDです。(WordPress 2.8で追加されました。)

(integer) (optional) Post ID (added in WordPress 2.8).

Default: None

デフォルトの使い方

デフォルトで使用する記事を編集するリンクを表示します。

Displays edit post link using defaults.

<?php edit_post_link(); ?>

パラグラフタグ内に編集を表示する方法

パラグラフ(

)タグ内に、 “編集”のリンクテキストで、記事を編集するリンクを表示します。

Displays edit post link, with link text “edit”, in a paragraph (

) tag.

<?php edit_post_link('edit', '<p>', '</p>'); ?>

変更ログ

  • 2.8 : Added the id parameter.
  • Since: 1.0.0

ソースファイル

edit_post_linkは下記のテンプレートファイル内に位置しています。

edit_post_link() is located in

  • wp-includes/link-template.php (the latest stable version)
  • wp-includes/link-template.php (the development version)

関連テンプレートタグ

edit_post_link, edit_comment_link, edit_tag_link, edit_bookmark_link

Sponsored Link