Modify get_permalink with a specific filter

Solved!,

Change $postID by $post->ID, so, rewriting function:

function noticias_print_permalink( $permalink, $post, $leavename ){
    $external_link = get_post_meta( $post->ID, 'external_link', true );
    if( !empty( $external_link ) ) {
        $permalink = $external_link;
    }
    return $permalink;
}

Regards.

Leave a Comment