Edit the post title from the frontend

Question

I have this form that allows-me to change some things of the current post in my frontend:

<form id="featured_upload" name="featured_upload" method="post" action="#" enctype="multipart/form-data">
<p><span class="badge badge-primary"><input type="file" name="my_image_upload" id="my_image_upload" multiple="false" required /></span></p>
<p><input type="text" name="newtags" id="newtags" value="" placeholder="new tags aqui..." /> <input type="text" name="h2" id="h2" value="" placeholder="h2 heading aqui..." /></p>
<p><input type="hidden" name="post_id" id="post_id" value="" /></p>
<?php wp_nonce_field( 'my_image_upload', 'my_image_upload_nonce' ); ?>
<span class="badge badge-light" ><input id="" name="" type="submit" value="Upload"/></span>
</form>  

Starting the saving process…

// Check the nonce is valid, and the user can edit this post.
if ( isset( $_POST['my_image_upload_nonce'], $_POST['post_id'] ) 
    && wp_verify_nonce( $_POST['my_image_upload_nonce'], 'my_image_upload' )
    && current_user_can( 'manage_options', $_POST['post_id'] )) {

What I would like to do is to have the habitability of changing the post title (and slug also, of course…).

Can this be implemented on this form?

0
, , , bpy 4 years 2019-11-28T05:29:08-05:00 0 Answers 104 views 0

Leave an answer

Browse
Browse