Skip to content

Commit 6f6decc

Browse files
Document 'wp_link_query_args' and 'wp_link_query' filters. props DrewAPicture. fixes #18042.
git-svn-id: https://develop.svn.wordpress.org/trunk@25299 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8e4a6b3 commit 6f6decc

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/wp-includes/class-wp-editor.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,17 @@ public static function wp_link_query( $args = array() ) {
798798

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

801+
/**
802+
* Filter the link query arguments.
803+
*
804+
* Allows modification of the link query arguments before querying.
805+
*
806+
* @see WP_Query for a full list of arguments
807+
*
808+
* @since 3.7.0
809+
*
810+
* @param array $query An array of WP_Query arguments.
811+
*/
801812
$query = apply_filters( 'wp_link_query_args', $query );
802813

803814
// Do main query.
@@ -823,6 +834,25 @@ public static function wp_link_query( $args = array() ) {
823834
);
824835
}
825836

837+
/**
838+
* Filter the link query results.
839+
*
840+
* Allows modification of the returned link query results.
841+
*
842+
* @since 3.7.0
843+
*
844+
* @param array $results {
845+
* An associative array of query results.
846+
*
847+
* @type array {
848+
* @type int 'ID' The post ID.
849+
* @type string 'title' The trimmed, escaped post title.
850+
* @type string 'permalink' The post permalink.
851+
* @type string 'info' A 'Y/m/d'-formatted date for 'post' post type, the 'singular_name' post type label otherwise.
852+
* }
853+
* }
854+
* @param array $query An array of WP_Query arguments. @see 'wp_link_query_args' filter
855+
*/
826856
return apply_filters( 'wp_link_query', $results, $query );
827857
}
828858

0 commit comments

Comments
 (0)