Skip to content

Instantly share code, notes, and snippets.

@DrewAPicture
Last active August 29, 2015 14:16
Show Gist options
  • Save DrewAPicture/9071609686a0218f29a4 to your computer and use it in GitHub Desktop.
Save DrewAPicture/9071609686a0218f29a4 to your computer and use it in GitHub Desktop.
/**
* Filter whether to skip parsing duplicate hooks.
*
* "Duplicate hooks" are characterized in WordPress core by a preceding DocBlock comment
* including the phrases "This action is documented in" or "This filter is documented in".
*
* Passing a truthy value will skip the parsing of duplicate hooks.
*
* @param bool $skip Whether to skip parsing duplicate hooks. Default false.
*/
$skip_duplicates = apply_filters( 'wp_parser_skip_duplicate_hooks', false );
if ( false !== $skip_duplicates ) {
if ( 0 === strpos( $data['doc']['description'], 'This action is documented in' ) ) {
return false;
}
if ( 0 === strpos( $data['doc']['description'], 'This filter is documented in' ) ) {
return false;
}
if ( '' === $data['doc']['description'] && '' === $data['doc']['long_description'] ) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment