Specify which post to edit.. edit_post_link (2 posts)

  1. Scooby
    Posted 7 years ago #

    Is there any way to specify a specific post to edit using edit_post_link??

    Here's my situation..

    I have created a page that contains a post from a specific category.. The post has its own edit link as well as does the page.. The edit_post_link for both only links to the post on the page and not the page content itself.. One should edit the post and one should edit the page content..

    Code used:
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>

  2. jcdesign
    Posted 7 years ago #

    I've needed this in several cases, particularly when including a page on other pages using Brent Loertcher's Include Page plugin. I rolled this:

    function edit_another_post($post_id, $link = 'Edit This', $before = '', $after = '') {
        global $user_ID;
    	if (!user_can_edit_post($user_ID, $post_id)) {
        $location = get_settings('siteurl') . "/wp-admin/post.php?action=edit&amp;post=$post_id";
        echo "$before <a href=\"$location\">$link</a> $after";

    Hope that helps someone :)

Topic Closed

This topic has been closed to new replies.

About this Topic