Sql formatting for post data within function

It isn’t showing wp_posts.post_content LIKE '%test%' because the wildcards (%) in the prepared statement are converted to placeholder escape strings (like the {a19f0a6c3d866f7270be0f3954cbb2600270400c15f488e112449a8a131701f0} in your post) when wpdb::prepare() calls wpdb::add_placeholder_escape() which “Adds a placeholder escape string, to escape anything that resembles a printf() placeholder“, i.e. a placeholder like %s.

But those placeholder escape strings will be changed back to % when the statement is passed to MySQL, so there’s no need to worry about those escape strings.

Additionally, make sure to use the correct prepare() syntax — there should be at least one placeholder and a substitution argument (for that placeholder) like so: $wpdb->prepare( "SELECT * FROM foo WHERE bar = %s", 'bar value' ).

Also, you should apply wpdb::esc_like() on the $search value to ensure % in the value are properly escaped.

And you might also want to check out my recent answer here because (I thought) the question there seemed quite similar to your question..