WordPress at a glance
function is not described

_WP_Editors::wp_link_query() public WP 3.1.0

Performs post queries for internal linking.

This is a method of the class: _WP_Editors{}

Hooks from the method
Return

Array/false. Results.

Usage

$result = _WP_Editors::wp_link_query( $args );
$args(array)
Accepts 'pagenum' and 's' (search) arguments.
Default: array()

Changelog

Since 3.1.0 Introduced.

Code of WP Editors::wp link query: wp-includes/class-wp-editor.php WP 5.4.2

<?php
public static function wp_link_query( $args = array() ) {
	$pts      = get_post_types( array( 'public' => true ), 'objects' );
	$pt_names = array_keys( $pts );

	$query = array(
		'post_type'              => $pt_names,
		'suppress_filters'       => true,
		'update_post_term_cache' => false,
		'update_post_meta_cache' => false,
		'post_status'            => 'publish',
		'posts_per_page'         => 20,
	);

	$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;

	if ( isset( $args['s'] ) ) {
		$query['s'] = $args['s'];
	}

	$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;

	/**
	 * Filters the link query arguments.
	 *
	 * Allows modification of the link query arguments before querying.
	 *
	 * @see WP_Query for a full list of arguments
	 *
	 * @since 3.7.0
	 *
	 * @param array $query An array of WP_Query arguments.
	 */
	$query = apply_filters( 'wp_link_query_args', $query );

	// Do main query.
	$get_posts = new WP_Query;
	$posts     = $get_posts->query( $query );

	// Build results.
	$results = array();
	foreach ( $posts as $post ) {
		if ( 'post' == $post->post_type ) {
			$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
		} else {
			$info = $pts[ $post->post_type ]->labels->singular_name;
		}

		$results[] = array(
			'ID'        => $post->ID,
			'title'     => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
			'permalink' => get_permalink( $post->ID ),
			'info'      => $info,
		);
	}

	/**
	 * Filters the link query results.
	 *
	 * Allows modification of the returned link query results.
	 *
	 * @since 3.7.0
	 *
	 * @see 'wp_link_query_args' filter
	 *
	 * @param array $results {
	 *     An associative array of query results.
	 *
	 *     @type array {
	 *         @type int    $ID        Post ID.
	 *         @type string $title     The trimmed, escaped post title.
	 *         @type string $permalink Post permalink.
	 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
	 *                                 the 'singular_name' post type label otherwise.
	 *     }
	 * }
	 * @param array $query  An array of WP_Query arguments.
	 */
	$results = apply_filters( 'wp_link_query', $results, $query );

	return ! empty( $results ) ? $results : false;
}