Ignore posts content in the posts queries for internal linking
I am looking for a filter to ignore searching in posts content from the posts editor which is natively using the link function. https://developer.wordpress.org/reference/classes/_wp_editors/wp_link_query/
Use case: with 300,000 articles, the query is too slow, searching in titles and excerpt is good enough.
Internal linking happens in the Classic Editor; example below:
Action:
- /wp-admin/admin-ajax.php
Form Data:
- action: wp-link-ajax
- page: 1
- search: Hello world
Thank you,
UPDATE:
I changed in class-wp-query.php the line:
$search .= $wpdb-prepare( "{$searchand}(({$wpdb-posts}.post_title $like_op %s) $andor_op ({$wpdb-posts}.post_excerpt $like_op %s) $andor_op ({$wpdb-posts}.post_content $like_op %s))", $like, $like, $like );
To:
$search .= $wpdb-prepare( "{$searchand}(({$wpdb-posts}.post_title $like_op %s) $andor_op ({$wpdb-posts}.post_excerpt $like_op %s))", $like, $like, $like );
I wish there could be a more simple way to do so!