Developer Docs

WP Help Scout Docs offers several filters and constants, which allow developers and agencies to change its behavior from a custom plugin or their theme’s functions.php . Sorted alphabetically.

wp_help_scout_docs_api_page_size

Filter for the number of items WP Help Scout Docs requests per page from the Help Scout Docs API while syncing (default and maximum: 100). Lower it if your server runs into timeouts or memory limits while syncing large collections.

add_filter( 'wp_help_scout_docs_api_page_size', function () {
    return 50;
} );
Code language: JavaScript (javascript)

wp_help_scout_docs_category_page_compat

Return false  to keep using your (classic) theme’s archive template for category pages, instead of the design of your Documentation page. See Customize your Documentation.

add_filter( 'wp_help_scout_docs_category_page_compat', '__return_false' );
Code language: JavaScript (javascript)

wp_help_scout_docs_form_integration_load_everywhere

Return true  to load Form Integration on every page. By default, it’s loaded on pages that contain a form with the wp-help-scout-docs-search  class. Useful for forms in popups or page builder templates.

add_filter( 'wp_help_scout_docs_form_integration_load_everywhere', '__return_true' );
Code language: JavaScript (javascript)

wp_help_scout_docs_form_search_selector

Filter for the CSS selector of the fields that trigger Form Integration‘s search. Use it to connect a form field without adding a CSS class to it.

add_filter( 'wp_help_scout_docs_form_search_selector', function ( $selector ) {
    return $selector . ', #my-contact-form input[name="subject"]';
} );
Code language: PHP (php)

wp_help_scout_docs_form_search_stopwords

Filter for the words Form Integration leaves out when it searches your docs, e.g. how or the. Add common words in your own language to get better results.

add_filter( 'wp_help_scout_docs_form_search_stopwords', function ( $stopwords ) {
    return array_merge( $stopwords, [ 'hoe', 'wat', 'mijn' ] );
} );
Code language: PHP (php)

wp_help_scout_docs_image_sources

Filter for the hosts images are downloaded from and stored on your own site, as host => path . By default, these are the hosts Help Scout Docs stores uploaded images on.

add_filter( 'wp_help_scout_docs_image_sources', function ( $sources ) {
    $sources[ 'images.example.com' ] = '/docs/';

    return $sources;
} );
Code language: PHP (php)

wp_help_scout_docs_localize_images

Return false  to keep loading the images in your articles from Help Scout, instead of storing them on your own site.

add_filter( 'wp_help_scout_docs_localize_images', '__return_false' );
Code language: JavaScript (javascript)

wp_help_scout_docs_search_page_compat

Return false  to keep using your (classic) theme’s search template for searches within your docs, instead of the design of your Documentation page. See Customize your Documentation.

add_filter( 'wp_help_scout_docs_search_page_compat', '__return_false' );
Code language: JavaScript (javascript)

wp_help_scout_docs_setting_{option_name}

Filter to force the value of a single setting, e.g. to keep it the same on all your clients’ sites. The option names are api_key , base , collection_id , auto_toc , restrict_search , use_archive , debug , scheduled_rebuild , rebuild_schedule , compress_images , form_integration  and form_results_header . Checkboxes are 'on'  when enabled.

add_filter( 'wp_help_scout_docs_setting_auto_toc', function () {
    return 'on';
} );
Code language: JavaScript (javascript)

wp_help_scout_docs_settings

Filter for all settings at once, after they’re loaded from the database. Useful to change several settings in one go.

wp_help_scout_docs_settings_defaults

Filter for the default values of all settings, which are used as long as a setting hasn’t been saved.

wp_help_scout_docs_toc_title

Filter for the title above the Table of Contents, when Auto TOC is enabled (default: <h2>Table of Contents</h2> ).

add_filter( 'wp_help_scout_docs_toc_title', function () {
    return '<h2>On this page</h2>';
} );
Code language: JavaScript (javascript)

Constants

Instead of using the settings screen, you can also configure WP Help Scout Docs by defining constants in your wp-config.php  file. Constants always take precedence over the settings screen.

  • WP_HELP_SCOUT_DOCS_API_KEY : API Key
  • WP_HELP_SCOUT_DOCS_BASE : Base URI
  • WP_HELP_SCOUT_DOCS_COLLECTION_ID : Collection
  • WP_HELP_SCOUT_DOCS_TOC : Auto TOC
  • WP_HELP_SCOUT_DOCS_RESTRICT_SEARCH : Restrict Search to Docs
  • WP_HELP_SCOUT_DOCS_COMPRESS_IMAGES : Compress Images
  • WP_HELP_SCOUT_DOCS_ARCHIVE : Theme & Page Builder Support
  • WP_HELP_SCOUT_DOCS_SCHEDULED_REBUILD : Sync Docs by Schedule
  • WP_HELP_SCOUT_DOCS_REBUILD_SCHEDULE : Sync Schedule (daily , twice_weekly , weekly , twice_monthly  or monthly )
  • WP_HELP_SCOUT_DOCS_DEBUG : Debug Mode
define( 'WP_HELP_SCOUT_DOCS_API_KEY', 'your-api-key' );
define( 'WP_HELP_SCOUT_DOCS_TOC', 'on' );
Code language: JavaScript (javascript)