Hi @5vlast
Looks like your if statement:
if( $post_id != 'new' )
{
return $post_id;
}
will fail becuase your post_id is never going to be ‘new’, it will always be ‘!new’.
I believe some debugging is needed to figure out the issue and get it working. Debug line by line and ask yourself why it isn’t working.
Good luck!