Title: wp_doc_link_parse
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_doc_link_parse( string $content ): string[]

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#changelog)

Parses the PHP content and finds function calls to be used for documentation linking.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#parameters)󠁿

 `$content`stringrequired

The PHP content to parse.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#return)󠁿

 string[] Array of function names.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#source)󠁿

    ```php
    function wp_doc_link_parse( $content ) {
    	if ( ! is_string( $content ) || empty( $content ) ) {
    		return array();
    	}

    	if ( ! function_exists( 'token_get_all' ) ) {
    		return array();
    	}

    	$tokens           = token_get_all( $content );
    	$count            = count( $tokens );
    	$functions        = array();
    	$ignore_functions = array();

    	for ( $t = 0; $t < $count - 2; $t++ ) {
    		if ( ! is_array( $tokens[ $t ] ) ) {
    			continue;
    		}

    		if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) {
    			// If it's a function or class defined locally, there's not going to be any docs available.
    			if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) )
    				|| ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR === $tokens[ $t - 1 ][0] )
    			) {
    				$ignore_functions[] = $tokens[ $t ][1];
    			}

    			// Add this to our stack of unique references.
    			$functions[] = $tokens[ $t ][1];
    		}
    	}

    	$functions = array_unique( $functions );
    	sort( $functions );

    	/**
    	 * Filters the list of functions and classes to be ignored from the documentation lookup.
    	 *
    	 * @since 2.8.0
    	 *
    	 * @param string[] $ignore_functions Array of names of functions and classes to be ignored.
    	 */
    	$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );

    	$ignore_functions = array_unique( $ignore_functions );

    	$output = array();

    	foreach ( $functions as $function ) {
    		if ( in_array( $function, $ignore_functions, true ) ) {
    			continue;
    		}

    		$output[] = $function;
    	}

    	return $output;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/misc.php#L635)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/misc.php#L635-L692)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#hooks)󠁿

 [apply_filters( ‘documentation_ignore_functions’, string[] $ignore_functions )](https://developer.wordpress.org/reference/hooks/documentation_ignore_functions/)

Filters the list of functions and classes to be ignored from the documentation lookup.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#related)󠁿

| Uses | Description | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_doc_link_parse/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_doc_link_parse%2F)
before being able to contribute a note or feedback.