WP User Frontend
How can i get the id of the post i am editing on the edit post page (2 posts)

  1. Connor Miles
    Posted 3 years ago #


    i have come up with a really good idea to preview the post as your editing it and that is to get a iframe with a src of http://localhost/?p=<?php the_ID(); ?>&preview=true but unfortunately this creates a infinate loop of iframes of the actual edit page not the page your editing in the edit page.

    so i am looking to get the id of the page im editing in the edit page.

    Thanks in advanced..

    ps. would be cool "like that preview commments thing on css-tricks"


  2. professor99
    Posted 3 years ago #

    the_ID() only works for posts being displayed by the loop

    From it's Codex desciption

    Displays the numeric ID of the current post. This tag must be within The Loop.


    In any case there's more too it that just using the preview=true url with the id of the post.

    FrontEnd uses the WordPress wp_editor() function to edit the post which displays the post in the TinyMCE editor.

    To preview the post you could try emulating the code for the Preview buttons for the standard admin Add New Post (post-new.php) and Edit Post (post.php) pages.

    It would be nice to have this as a feature of Frontend so if you have any luck please let us know.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP User Frontend
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic