Support

Account

Home Forums Front-end Issues Question about variable on the front end – Functions.php

Unread

Question about variable on the front end – Functions.php

  • In my theme functions file put the following code

    //CADASTRO DE CURRICULUNS PELO CLIENTE 
    function cadastra_curriculuns( $post_id )
    {
        // check if this is to be a new post
        if( $post_id != 'new' )
        {
            return $post_id;
        }
     
        // Create a new post
        $post = array(
           'post_status'  => 'draft' , //Salva como rascunho
            'post_title'  => '$nome' , //Titulo do Post
            'post_type'  => 'post' , //Onde vai gravar, neste caso no Custon Post Type = Movie
        );  
     
        // insert the post
        $post_id = wp_insert_post( $post ); 
     
        // update $_POST['return']
        $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );    
     
        // return the new ID
        return $post_id;
    }
     
    add_filter('acf/pre_save_post' , 'cadastra_curriculuns' );

    Works right so that does not write the variable $ name in the wordpress dashboard.
      ‘post_title’ => ‘$ name’, / / Title of Post
    What am I doing wrong in this line?

Viewing 1 post (of 1 total)

The topic ‘Question about variable on the front end – Functions.php’ is closed to new replies.