Support » Fixing WordPress » Specify which post to edit.. edit_post_link

  • 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>'); ?>

Viewing 1 replies (of 1 total)
  • jcdesign


    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 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Specify which post to edit.. edit_post_link’ is closed to new replies.