My problem is as follows, I created a custom post type called "Home Highlights" and inside it the user adds the post they want, these posts come from a select_advanced Metabox , I made a function to pass the selected post to the current post title, however it ends up returning a number I do not know why.
Here's my function and some prints to help with understanding:
add_filter( 'the_title', 'teste', 10, 2 );
function teste( $title, $post_id )
{
if( $new_title = get_post_meta( get_the_ID(), 'id_do_metabox', true ) )
{
return $new_title;
}
return $title;
}