WordPress.org

Support

Support » Plugins and Hacks » WP User Frontend » How can i get the id of the post i am editing on the edit post page

How can i get the id of the post i am editing on the edit post page

  • hello,

    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”

    http://wordpress.org/extend/plugins/wp-user-frontend/

Viewing 1 replies (of 1 total)
  • 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.

    Cheers
    TheProfessor

Viewing 1 replies (of 1 total)
  • The topic ‘How can i get the id of the post i am editing on the edit post page’ is closed to new replies.
Skip to toolbar