Saturday, September 17, 2022
HomeWordPress Developmentplugin growth - Easy methods to change put up cpt with submit...

plugin growth – Easy methods to change put up cpt with submit button?


Εvery put up should have an submit button and when person click on it then the put up goes to a different cpt.

perform click_button()
{
 $button=  '<kind id="formid" motion="button.php" technique="put up">
<enter sort="hidden" identify="motion" worth="button" class="button"/>
<enter sort="submit" identify="Submit" class="button"/>
</kind>';
    
    return $button;
}

add_shortcode( 'button', 'click_button' );

button.php

perform button()
    {
    
    if($_POST['submit']) {
    
        //echo "Howdy world!";
         $information = array(
            'ID' => $post_id,
            'post_type' => 'bdg_books_wanted'
       );

        wp_update_post( $information );
        
}


Can somebody inform me what i’m doing unsuitable?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments