Filter link to existing content suggestion

How can i filter the link given in “link to existing content”.

Eg:enter image description here

As in the above image. I just want WSP BANNER TO BE SHOWN.

where WSP BANNER & CALENDAR are custom POST types

Any help will be appreciable.

4 Answers
4

Currently there are no ready filters available for this purpose. A ticket has been posted for the request.Lets hope we get one soon.

Instead of hardcoding your custom post types its better to create a filter hook and use it

Till then you can create your own filter.

Open includes/class-wp-editor.php and make folowing changes at line no 712

$pt_names = apply_filters('custom_insert_link_suggestion_filter',array_keys( $pts ));

we just added a new filter instead of getting all the public post types

Then in your theme add following code to filter the internal link custom post type

function my_filter_function($allowed_post_types)
{


if( condition chek)
{
         return array('page','your custom post types');
}


}
add_filter('custom_insert_link_suggestion_filter','my_filter_function',10,1);

Leave a Comment