how to filter “link to existing content” suggestion in wordpress?

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

enter image description here

Read More

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

where WSP BANNER & CALENDAR are custom post_type

Any help will be appreciable.

Related posts

Leave a Reply

3 comments

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

    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);

  2. Consider an example where my site is configured on wp.abc.com and I point my root domain http://www.abc.com to the new site. I need to update the URL’s in General Setting. So when I update the URL, it is reflected in menu items etc. Will it be reflected in the content area links aslo?