WP get_permalink Wrong Result

I have custom post type named : easytask, and the following code is shortcode from plugin to retrieve data from custom post above ( easytask ).

function easy_shortcode( $attr ) {

    // Shortcode parameter
    extract( shortcode_atts( array(
        'med' => -1,
        ), $attr ) );

    $easy_id = explode( ",", $med );

    // Get data from custom post type
    $easy_arg = array(
        'post__in' => $easy_id, 
        'post_type' => 'easytask',

    $easy_query = new WP_Query( $easy_arg );

    if ( $easy_query->have_posts() ):

        while ( $easy_query->have_posts() ) : $easy_query->the_post();

            // Content from our custom Post goes here...



        // If empty



add_shortcode( 'easy-task', 'easy_shortcode' );

But when I put the shortcode into the blog list, the theme function that use get_permalink return the wrong URL, in this case the URL should be return to the post URL itself, but my issue is the URL return the custom post URL.

The following code is the theme function I found in theme functions.php that conflict with the shortcode:

function adventure_posted_on() {

        printf( __( '<span class="%1$s">Last Updated:</span> %2$s <span class="meta-sep">by</span> %3$s', 'organic-adventure' ),
            'meta-prep meta-prep-author',
            sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
                esc_url( get_permalink() ),
                esc_attr( get_the_modified_time() )
            sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
                esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
                sprintf( esc_attr__( 'View all posts by %s', 'organic-adventure' ), get_the_author() ),

Can anyone help me with this?

Read more here: WP get_permalink Wrong Result

Leave a Reply

Your email address will not be published. Required fields are marked *