• Resolved DenisCGN

    (@deniscgn)


    Hello,

    I try to check if the single page is a Custom Post Type “locahero_profile”.
    I created the CPT with the plugin.

    When I try to change the author_link on this special CPT nothing happens.

    function my_author_link( $link ) {	
    	if ( is_singular( 'localhero_profile' ) ) {
    		global $post;
    			$profile_ID = get_user_meta($post->ID, '_cptID', true);
    			$link = get_permalink( $profile_ID );
    		return $link;
    	} else {	
    		return 'HELLO';	
    	}
    }
    add_filter( 'author_link', 'my_author_link', 10, 1 );

    Any suggestion why the CPT is not checked? Did I miss some settings?

    Cheers,
    Denis

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter DenisCGN

    (@deniscgn)

    Somehow it seems to work now ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    only thing I would have had to suggest before it self-solved, would have been to move the global $post line outside the is_singular call, in case the first part relied on the $post object.

    Glad it worked out in the end.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_singular and CPT’ is closed to new replies.