It’s because you’re not outputting the ID into data-like
:
data-like="<?php echo isset($existQuery->posts[0]->ID); ?>"
You are outputting whether the ID isset()
, which is true
, which is being turned into 1
. You need to output the actual ID:
data-like="<?php echo isset( $existQuery->posts[0]->ID ) ? esc_attr( $existQuery->posts[0]->ID ) : ''; ?>"