How to hide search wp link dialog from visual text editor in wordpress?
How to hide search wp linp dialog from visual text editor in wordpress?
function disable_mce_wptextpattern( $opt ) {
if ( isset( $opt['plugins'] ) && $opt['plugins'] ) {
error_log(print_r($opt,true));
$opt['plugins'] = explode( ',', $opt['plugins'] );
$opt['plugins'] = array_diff( $opt['plugins'] , array( 'wplink' ) );
$opt['plugins'] = implode( ',', $opt['plugins'] );
}
return $opt;
}
add_filter( 'tiny_mce_before_init', 'disable_mce_wptextpattern' ); //totally remove wplink dialog and even icon for adding link
//
OR hide just search page dialog
//
add_filter( 'wp_link_query', 'remove_results_from_link_builder_autocomplete', 10, 2 );
function remove_results_from_link_builder_autocomplete( $results, $query ) {
return array();
}
///
OR
//
function custom_wp_link_query_args($query)
{
$pt_new = array();
$exclude_types = array('exclude_post_types_here');
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', 'custom_wp_link_query_args');
//now you can hide it in css
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
#wplink-link-existing-content,
#search-panel {
display: none;
}
#wp-link-wrap {
height: 225px;
}
</style>';
}
How to hide search wp linp dialog from visual text editor in wordpress?