Skip to content
StaticScope
Overview
Get StaticScope

Core filters

Every filter StaticScope core provides, including the generated option filters and the one that breaks the naming rule.

Developers Updated 21 November 2026 8 min read

Filters change a value on its way through the build. Core has 45 of them outside the option family, plus 29 generated option filters and one exception. This page covers them all with their arguments and defaults.

Defaults matter. A boolean filter set to true needs __return_false to switch it off, and an integer filter set to 1 needs __return_zero. Returning nothing turns a string into an empty string and a boolean into null, which is not the same as false. Some of these run thousands of times: staticscope_discovered_paths fires per crawled file, and the option filters fire on every read. Keep the callbacks cheap. If a value needs a database query, compute it once in a static and return the cached result on later calls.

Add-on registration

FilterArguments and defaultWhat it does
staticscope_addonsarray $addons: empty until an add-on appendsEach entry needs slug, type (deploy, crawl, process or sync), name, docs_url and description. StaticScope uses this to decide what is installed and which add-on publishes.

Detection

FilterArguments and defaultWhat it does
staticscope_filenames_to_ignorestring[] $namesFile names, folder names and path fragments left out of upload discovery, extra folders, asset discovery, crawlability checks and the site check.
staticscope_file_extensions_to_ignorestring[] $extensionsExtensions such as .zip or php, applied at the same five call sites.
staticscope_detect_sitemapsint $detect: 1Return 0 to skip sitemap discovery.
staticscope_detect_parent_themeint $detect: the detectAllAssets optionList every file in the parent theme instead of only files pages use.
staticscope_detect_child_themeint $detect: detectAllAssetsThe same for the child theme.
staticscope_detect_plugin_assetsint $detect: detectAllAssetsThe same for plugin folders.
staticscope_detect_wpinc_assetsint $detect: detectAllAssetsThe same for wp-includes.
staticscope_detect_vendor_cacheint $detect: detectAllAssetsThe same for cached and vendor files.
staticscope_detect_posts_paginationint $detect: 1Return 0 to skip /page/2/-style URLs.
staticscope_detect_archivesint $detect: detectDateArchivesDate archives.
staticscope_detect_categoriesint $detect: detectTermArchivesCategory, tag and other term archives.
staticscope_detect_category_paginationint $detect: detectTermArchivesPaginated term archives.
staticscope_detect_authorsint $detect: detectAuthorArchivesAuthor archives.
staticscope_detect_authors_paginationint $detect: detectAuthorArchivesPaginated author archives.
staticscope_modify_initial_crawl_liststring[] $urls: cleaned, root-relativeRuns after detection sources are merged and excluded pages removed, before duplicates collapse. The main place to add or remove detected URLs.
staticscope_siteinfoarray $info: paths and URLsApplied when SiteInfo is first built, then cached for the request. Keys include site_url, home_url, content_path, uploads_url, plugins_path, parent_theme_path and child_theme_url.

Changing siteinfo changes the paths StaticScope uses everywhere, including where it reads theme files. On a normal install you should not need it. It exists for Bedrock-style layouts and other moved folders.

The ignore filters work on fragments, not globs. A name of private also excludes private-client and /private-notes/. Check the entry in the setting before you add a short fragment to code.

Crawling

FilterArguments and defaultWhat it does
staticscope_crawl_connect_tostring|null $connect_to: null to detect; string $site_url"host:port" to send crawl requests somewhere else while keeping the site URL and Host header. Return '' to never reroute.
staticscope_curl_portint|null $port: nullLegacy port override, only consulted when crawl_connect_to did not return a string.
staticscope_curl_user_agentstring $agent: StaticScope.comEvery request the crawler, loopback probe and sitemap detector make.
staticscope_discover_urlsbool $discover: trueReturn false to stop following links and asset references. Only the detected URLs are copied.
staticscope_discovered_pathsstring[] $paths, string $urlFor every crawled file, after parsing and before new paths are queued. Add paths the parser cannot see, or drop ones you do not want.
staticscope_prune_unused_filesbool $prune: trueReturn false to keep every detected or discovered file, referenced or not.
staticscope_generate_404bool $generate: trueWhether to request the site’s 404 page and save it as 404.html.

staticscope_crawl_connect_to is for containers and split DNS. Put host:port in front of a site whose own hostname does not resolve from inside the container, and the crawler reaches it without rewriting links.

staticscope_discover_urls set to false is the switch for a strict list-only build. Pair it with staticscope_modify_initial_crawl_list when you want to add URLs by hand, because nothing else will.

Paths and URLs

FilterArguments and defaultWhat it does
staticscope_crawled_site_pathstring $path: uploads/staticscope-crawled-siteWhere the copied site is written.
staticscope_processed_site_pathstring $path: uploads/staticscope-processed-siteWhere the prepared site is written. Publishers receive this through staticscope_deploy.
staticscope_preview_pathstring $path: uploads/staticscope-previewThe preview folder.
staticscope_preview_urlstring $url: uploads/staticscope-previewThe preview’s public URL. The caller adds the trailing slash.
staticscope_set_destination_urlstring $url: the deploymentURL option, unslashedThe address links are rewritten to, and the address used by sitemaps and dead-link checks.
staticscope_set_wordpress_site_urlstring $url: WordPress’s site URL, unslashedThe address links are rewritten from.

The two URL filters are a pair. Rewriting only works when both sides are right, and an add-on that changes the destination usually changes it on staticscope_post_process_start so the value is in place before any file is touched.

Post-processing

FilterArguments and defaultWhat it does
staticscope_check_sitebool $check: trueWhether to run the site check after preparation. GitHub switches it off temporarily during a publish.
staticscope_tidy_sitemapsbool $tidy: trueAt priority 5, before pages missing from the prepared site are removed from sitemaps.
staticscope_reconcile_robotsbool $reconcile: trueAt priority 10, before robots.txt is pointed at the sitemaps that exist.
staticscope_remove_dead_linksbool $remove: trueAt priority 20, before links to missing prepared files are stripped.
staticscope_add_nojekyllbool $add: trueAt priority 1, before an empty .nojekyll is written for GitHub Pages.
staticscope_runtime_pathsstring[] $paths: root-relative; a trailing slash means a folderFiles the site check allows to exist without being referenced, such as a search index.

Publishing

FilterArguments and defaultWhat it does
staticscope_deploy_webhook_user_agentstring $agent: StaticScope.comOnly when a completion webhook is configured, immediately before the request.
staticscope_deploy_webhook_bodymixed $body: a string for POST, an array for GETThe completion webhook’s body. Return the same shape.
staticscope_deploy_webhook_headersarray $headers: emptyRequest headers, for authorisation or a custom content type.
staticscope_publish_blocked_reasonstring $reason: empty; int $copied: Unix time or 0Return a sentence to explain why the last build must be rebuilt. A non-empty reason hides Publish on the Overview.
staticscope_publish_capabilitystring $capability: manage_optionsThe capability for the Publish site screen and menu item. GitHub substitutes its own when it publishes.
staticscope_managed_publishingarray|null $managed: nullReturn name, url and addresses to send Publish site to an add-on’s own screen.

Admin screens

FilterArguments and defaultWhat it does
staticscope_show_admin_noticesbool $show: falseWhether StaticScope’s own admin_notices callback is registered at all. Return true to let its notices appear.
staticscope_menu_after_publishstring[] $slugs: emptyAdmin page slugs to place directly after Publish site.
staticscope_render_jobs_page_varsarray $view with nonceAction and jobsImmediately before the Background jobs template is loaded. Change what the template receives.

Examples

Add a URL detection missed

add_filter( 'staticscope_modify_initial_crawl_list', function ( array $urls ) {
	$urls[] = '/downloads/';
	$urls[] = '/downloads/manual.pdf';

	return array_values( array_unique( $urls ) );
} );

URLs must be root-relative and start with a slash. This runs after the Pages to leave out setting has been applied, so an address you add here is not checked against it. Add the URL on purpose.

Rewrite to a different address

add_filter( 'staticscope_set_wordpress_site_url', function () {
	return 'https://cms.example.com';
} );

add_filter( 'staticscope_set_destination_url', function () {
	return 'https://www.example.com';
} );

Both values are unslashed. The first is what links are rewritten from, the second what they become. Setting only the destination is usually enough, because WordPress’s own site URL is already correct.

Copy an asset the parser cannot see

add_filter( 'staticscope_discovered_paths', function ( array $paths, string $url ) {
	if ( str_contains( $url, '/app/' ) ) {
		$paths[] = '/wp-content/uploads/app/chunk.js';
	}

	return $paths;
}, 10, 2 );

Return root-relative paths. This fires per crawled file, so guard it on the URL you care about instead of adding the asset on every page.

Block a publish with a reason

add_filter( 'staticscope_publish_blocked_reason', function ( string $reason, int $copied ) {
	if ( $copied > 0 && my_content_is_newer( $copied ) ) {
		return 'Content changed since this build. Build again first.';
	}

	return $reason;
}, 10, 2 );

This removes the Publish button on the Overview and on the add-on screens. It does not stop wp staticscope deploy, which never reads it. For a hard gate that covers CLI too, throw from staticscope_deploy at priority 9.

Authenticate a completion webhook

add_filter( 'staticscope_deploy_webhook_headers', function ( array $headers ) {
	$headers['Authorization'] = 'Bearer ' . MY_WEBHOOK_TOKEN;

	return $headers;
} );

Set the token in wp-config.php rather than in the snippet, so it is not in version control with the rest of your code.

The generated option filters

Every core option has a filter named staticscope_option_ plus the option’s name as written in CoreOptions::optionSpecs(). The name is built in makeOptionSpec() and applied whenever the option is read through getValue(), get() or getAll(). That covers settings rendering, detection, crawling, preparation and publishing.

The signature is always one parameter: the stored value as a string. Password options arrive decrypted. Array options arrive as one newline-delimited string, so split on \n, change the lines and join them again. Returning an array gives an empty string, because non-scalar values are dropped.

add_filter( 'staticscope_option_crawlConcurrency', function ( $value ) {
	return wp_get_environment_type() === 'local' ? '2' : '8';
} );

Filters run on read, not on save. Nothing is written to wp_options, so the saved value stays intact and removing the snippet restores the old behaviour.

Option filter suffixType
detectCustomPostTypesboolean
detectPagesboolean
detectPostsboolean
detectDateArchivesboolean
detectTermArchivesboolean
detectAuthorArchivesboolean
pagesToExcludearray
detectUploadsboolean
detectAllAssetsboolean
queueJobOnPostSaveboolean
queueJobOnPostDeleteboolean
processQueueImmediatelyboolean
processQueueIntervalinteger
autoJobQueueDetectionboolean
autoJobQueueCrawlingboolean
autoJobQueuePostProcessingboolean
autoJobQueueDeploymentboolean
basicAuthUserstring
deploymentURLstring
basicAuthPasswordpassword
completionEmailstring
completionWebhookstring
completionWebhookMethodstring
crawlConcurrencyinteger
fileExtensionsToIgnorearray
filenamesToIgnorearray
additionalURLsarray
hostsToRewritearray
skipURLRewriteboolean

One option does not follow the rule. useCrawlCaching is filtered as staticscope_use_crawl_cache. There is no staticscope_option_useCrawlCaching, and the list above omits the row. A handler on the wrong name fails silently, which is a failure that is difficult to diagnose.

Next