source/php/Editor.php
public function avoidDuplicatePostName($data, $postarr)
    {
        if (!isset($data['post_type']) || (isset($data['post_type']) && substr($data['post_type'], 0, 4) != 'mod-')) {
            return $data;
        }

        $data['post_name'] = $data['post_type'] . '_' . uniqid() . '_' . sanitize_title($data['post_title']);

        return $data;
    }
public function avoidDuplicatePostName($data, $postarr)
    {
        if (!isset($data['post_type']) || (isset($data['post_type']) && substr($data['post_type'], 0, 4) != 'mod-')) {
            return $data;
        }

        $data['post_name'] = $data['post_type'] . '_' . uniqid() . '_' . sanitize_title($data['post_title']);

        return $data;
    }
public function avoidDuplicatePostName ( $ data , $ postarr ) { if ( ! isset ( $ data [ 'post_type' ] ) || ( isset ( $ data [ 'post_type' ] ) && substr ( $ data [ 'post_type' ] , 0 , 4 ) != 'mod-' ) ) { return $ data ; } $ data [ 'post_name' ] = $ data [ 'post_type' ] . '_' . uniqid ( ) . '_' . sanitize_title ( $ data [ 'post_title' ] ) ; return $ data ; }
Avoid duplicate post_name in db
@param  array $data    Post data
@param  array $postarr Postarr
@return array          Post data to save
Avoid duplicate post_name in db