Support » Themes and Templates » Update button for wp_editor on theme front end

  • Resolved francomusso

    (@francomusso)


    Using the code below, I can very easily get the visual editor to appear on the front end of my theme, displaying the existing content ready to edit. (I love this!)

    <?php
    	$post = get_post($post_id, 'OBJECT');
    	wp_editor(esc_html($post->post_content), 'textarea01'); ?>

    The problem is that I cannot get an Update button to appear in order to submit the changes to the database and actually implement the changes made in the editor.

    I tried adding a submit button using a standard form input and then using submit_button() but this didn’t work, resulting in an error on the page.

    Please could someone help me with this? It seems like such an awesome feature to have!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Check out this introduction to posting from the front-end (you’ll need to change it a bit so you can update the current post):
    http://www.cozmoslabs.com/5528-wordpress-post-from-front-end/

    The thing is you need to process the form yourself. This means you’ll have to construct the form, add a submit button AND THEN have a function that’s hooked into init that will update the post based on the changes in the page:

    To update the post you can use:
    http://codex.wordpress.org/Function_Reference/wp_update_post

    Hi sareiodata, thanks so much for taking the time out to help.
    The article you provided was extremely helpful.
    Altough the functionality isn’t as easy to implement as I had anticipated, I think it’s definitely worth investing the time for such useful functionality… and the WCK Front End plugin and Creation Kit look fantastic too, by the way 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Update button for wp_editor on theme front end’ is closed to new replies.