Question about wordpress functions.php page

Discussion in 'WordPress' started by tdd1984, Apr 22, 2018.

  1. #1
    Hi I am trying to insert this function below onto the functions.php page. It's for gravity forms from https://docs.gravityforms.com/gform_upload_path/ . The problem is every I need to set the location like this /wp-content/uploads/leads/attachments/4052 where the 4052 is the post ID. However I can never seem to get the postID to echo on the functions page I tried using

    $post = get_post();

    but still did not work?

    add_filter( 'gform_upload_path', 'change_upload_path', 10, 2 );
    function change_upload_path( $path_info, $form_id ) {
       $path_info['path'] = '/home/public_html/yourdomainfolder/new/path/';
       $path_info['url'] = 'http://yourdomainhere.com/new/path/';
       return $path_info;
    }
    PHP:
     
    tdd1984, Apr 22, 2018 IP