Notice: Trying to get property of non-object in : custom fields category

Most probably the term was not found and $current_term returned as false:

$current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
$term_id = false === $current_term->term_id ? null : $current_term->term_id;

According to the docs, get_term_by() return values are

Term Row (object or array) from database. Will return false if
$taxonomy does not exist or $term was not found. Othewise returns
object (by default) or array of fields depending on $output parameter.

Output the $current_term value and see if it is false:

$current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
var_dump( $current_term );
$term_id = $current_term->term_id;