Remove custom post types from "Link to existing content" in the WordPress editor add link modal window.
<?php
function ccd_remove_cpt_modal_links( $query ) {
$pt_new = array();
$exclude_types = array( 'my_post_type' );
foreach ( $query['post_type'] as $pt )
{
if ( in_array( $pt, $exclude_types ) ) continue;
$pt_new[] = $pt;
}
$query['post_type'] = $pt_new;
return $query;
}
add_filter( 'wp_link_query_args', 'ccd_remove_cpt_modal_links' );
?>
WordPress Snippet