Admin Help Docs
The Admin Help Docs plugin has some useful hooks for developers to use to further enhance its functionality.
helpdocs_allowed_html
TYPE ⇢ Filter
TThis filter lets developers extend the set of HTML tags and attributes permitted in the Help Docs content. While the plugin already allows elements like <video>
, <iframe>
, <script>
, and <source>
through wp_kses_allowed_html()
, this hook provides a way to safely include additional semantic or interactive elements that WordPress would otherwise remove.
Example Usage
/**
* Allow additional media-related tags in Admin Help Docs content.
*
* @param array $tags The default allowed HTML tags and attributes.
*
* @return array Modified set including additional safe tags.
*/
add_filter( 'helpdocs_allowed_html', function( $tags ) {
return array_merge( $tags, [
// Enable <audio> tag with common attributes
'audio' => [
'src' => true,
'controls' => true,
'autoplay' => true,
'loop' => true,
'muted' => true,
'preload' => true,
],
// Enable <track> inside media for subtitles or captions
'track' => [
'src' => true,
'kind' => true,
'srclang' => true,
'label' => true,
'default' => true,
],
] );
}, 10 );
helpdocs_post_type_supports
TYPE ⇢ Filter
This filter allows developers to customize which core WordPress features are supported by the Help Documents custom post type (CPT), such as the title
, editor
, author
, excerpt
, and revisions
.
Example Usage
/**
* Add additional post type supports to Help Documents.
*
* @param array $supports The default supported features (e.g., title, editor, revisions).
*
* @return array Modified array including extra supported features.
*/
add_filter( 'helpdocs_post_type_supports', function( $supports ) {
// Enable featured images
$supports[] = 'thumbnail';
// Enable comment support
$supports[] = 'comments';
return $supports;
}, 10 );
helpdocs_post_type_taxonomies
TYPE ⇢ Filter
This filter lets developers attach taxonomies (built-in or custom) to the Help Documents CPT for better organization and filtering.
Example Usage
/**
* Register additional taxonomies for Help Documents.
*
* @param array $taxonomies The default taxonomies attached to the post type (usually empty).
*
* @return array Modified array of taxonomy slugs.
*/
add_filter( 'helpdocs_post_type_taxonomies', function( $taxonomies ) {
// Attach the default 'category' taxonomy
$taxonomies[] = 'category';
// Optionally add a custom taxonomy if registered elsewhere
$taxonomies[] = 'helpdoc_tag';
return $taxonomies;
}, 10 );
helpdocs_imports_supports
TYPE ⇢ Filter
This filter allows developers to customize which core WordPress features are supported by the "Imports" custom post type (CPT). By default, the "Imports" CPT supports features like title
and excerpt
. This filter allows developers to add or remove supports for other features like thumbnail
, comments
, etc., for better content management and flexibility.
Example Usage
/**
* Add additional post type supports to Imports CPT.
*
* @param array $supports The default supported features (e.g., title, excerpt).
*
* @return array Modified array including extra supported features.
*/
add_filter( 'helpdocs_imports_supports', function( $supports ) {
// Enable featured images
$supports[] = 'thumbnail';
// Enable comments support
$supports[] = 'comments';
return $supports;
}, 10 );
helpdocs_imports_taxonomies
TYPE ⇢ Filter
This filter allows developers to attach custom taxonomies (either built-in or custom) to the "Imports" custom post type (CPT). It gives the ability to organize and categorize imports more efficiently by using custom taxonomies such as category
, post_tag
, or any other registered taxonomy.
Example Usage
/**
* Register additional taxonomies for Imports CPT.
*
* @param array $taxonomies The default taxonomies attached to the post type (usually empty).
*
* @return array Modified array of taxonomy slugs.
*/
add_filter( 'helpdocs_imports_taxonomies', function( $taxonomies ) {
// Attach the default 'category' taxonomy
$taxonomies[] = 'category';
// Optionally, add a custom taxonomy
$taxonomies[] = 'import_tag';
return $taxonomies;
}, 10 );