Make sanitize_custom_id more correct

This commit is contained in:
Alex P 2021-11-16 16:09:02 +02:00
parent 3b98d8300b
commit f23df0b91c

View file

@ -31,7 +31,10 @@ trait PrefixTrait {
*/
private function sanitize_custom_id( string $custom_id ): int {
$id = str_replace( $this->prefix, '', $custom_id );
$id = $custom_id;
if ( strlen( $this->prefix ) > 0 && 0 === strpos( $id, $this->prefix ) ) {
$id = substr( $id, strlen( $this->prefix ) );
}
return (int) $id;
}
}