It’s a bit strange, but I got it working like this:
function bannerinfogp(){
$idgp = get_post_meta(
get_the_ID(), ‘id_carrera’, true);
if (empty($idgp)){
$topic_title = bbp_get_topic_title();
$entry = get_page_by_title( $topic_title, OBJECT, ‘post’ );
if ( $entry ) {
$custom_field = get_post_meta( $entry->ID, ‘id_carrera’, true );
$idgp = $custom_field;
}
It breaks me down a bit this way. It would be better if it doubled the custom field.
It would be more appropriate.