Skip to content

4SEO hooks

Below is a list of all 4SEO hooks which allows you to modify or extend its behavior programmatically.

Summary

4SEO currently offers 13 actions in 4 groups.
4SEO currently offers 56 filters in 21 groups.

Actions

4SEO currently offers 13 actions in 4 groups.

Group: Content

forseo_content_prepared

Content action

Action to let plugins obtain the finalized content for the current request

@param string $context The context of the content being passed to the plugin. @param mixed $row An object with a "text" property @param mixed $params Additional parameters. See {@see PlgContentContent()}. @param integer $page Optional page number. Unused. Defaults to zero.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 298

Group: Crawl

forseo_on_crawl_complete

Crawl action

Run actions when a full crawl has just completed.

@param array $crawl

@return void

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/crawler.php
@line 492

Group: Error

forseo_on_404_error

Error action

Run hook with the 404 error to allow actions by other parties.

@param \Exception $error

@return void

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/error.php
@line 127

forseo_on_error

Error action

Run hook with the error to allow actions by other parties.

@param \Exception $error

@return void

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/error.php
@line 155

Group: Events

forseo_onAfterDispatch

Events action

Hook to run the registered onAfterDispatch handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 337

forseo_onAfterDispatchComplete

Events action

Hook to run the registered onAfterDispatchComplete handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 370

forseo_onAfterInitialise

Events action

Hook to run the registered onAfterInitialise handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 148

forseo_onAfterRender

Events action

Hook to run the registered onAfterRoute handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 461

forseo_onAfterRenderComplete

Events action

Hook to run the registered onAfterRoute handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 517

forseo_onAfterRespond

Events action

Hook to run the registered onAfterRespond handlers.
Warning: body may be gzipped at this time.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 562

forseo_onAfterRoute

Events action

Hook to run the registered onAfterRoute handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 217

forseo_onBeforeCompileHead

Events action

Hook to run the registered onBeforeCompileHead handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 434

forseo_onBeforeRender

Events action

Hook to run the registered onBeforeRender handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 397

Filters

4SEO currently offers 56 filters in 21 groups.

Group: Admin

forseo_admin_ui_constants

Admin filter

Filter custom CSS for admin.

@param array $uiConstants List of constants related to the specific platform visual display.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/view/admin.php
@line 71

forseo_categories_list

Admin filter

Filter the list of categories on the site, for user display in the admin.

@param array $categories List of objects each describing a category.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/api/controller/categories.php
@line 175

forseo_custom_admin_css

Admin filter

Filter custom CSS for admin.

@param string $defaultStyles The raw css to be inserted as style tag in the page.

@return string

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/view/admin.php
@line 90

forseo_custom_admin_js

Admin filter

Filter custom JS for admin.

@param string $js The javascript to be inserted into the page with a script tag.

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/view/admin.php
@line 208

forseo_extensions_list

Admin filter

Filter the list of extensions installed on the site, for user display in the admin.

@param array $components List of objects each describing an extension.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/api/controller/extensions.php
@line 148

forseo_filter_extensions_list

Admin filter

Filter the list of extensions that should be filtered out of components lists displayed to users.

@param array $components Names of components using com_xxx format.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/api/controller/extensions.php
@line 123

Group: Analytics

forseo_analytics_snippets

Analytics filter

Filter the raw data used when outputting analytics snippet, for each configured
provider on the current page.

@param array $data Raw data to be used in snippets, per provider.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/injector/analytics.php
@line 108

Group: Bundle

forseo_admin_js_bundle_url

Bundle filter

Filter main JS bundle URL.

@param string $url The url of the js bundle to be linked from the page.

@return string

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/view/admin.php
@line 111

forseo_custom_admin_js

Bundle filter

Filter list of css files to be inserted after main bundle.
Each record added to the lsit must be:
[
'url' => '', mandatory
'options' => [], | []
'attr' => [], | []
]

@param array $cssDefs An array of array[url, options, attr], each defining a link to a css file.

@return string

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/view/admin.php
@line 358

Group: Content

forseo_current_request_category

Content filter

Filter the content category for current request belongs to.

@param object $category The category object as already established by wbLib.

@return object

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/rules.php
@line 366

forseo_expandable_variables

Content filter

Filter the list of dynamic variables used in content replacement.

@param array $expandedVariables Array of variable names/variable values to use in expansions.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/injector/variables.php
@line 112

forseo_filter_run_replacers

Content filter

Filter whether the content replacers should run on this page.

@param bool $shouldRunReplacers @param string $location content | component | anywhere | modules @param Input $input

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/rules.php
@line 713

forseo_onContentPrepare

Content filter

Hook to run the registered onContentPrepare handlers.

@param bool $modified Whether the content was modified. @param string $context The context of the content being passed to the plugin. @param mixed & $row An object with a "text" property @param mixed & $params Additional parameters. See {@see PlgContentContent()}. @param integer $page Optional page number. Unused. Defaults to zero.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 264

Group: Crawler

forseo_crawler_plugins_to_disable

Crawler filter

Filter the list of plugins that should be disabled on crawler requests.
Full page cache plugins should be disabled as they prevent onContentPrepare
and similar events to be fired.

@param array $plugins List of plugins, grouped by plugin group.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/platform.php
@line 83

Group: Cron

forseo_cron

Cron filter

Execute actions ran over cron. Each job can update the request response to reflect
success or otherwise.
type => image | cron

@param array $data API response data array: [[]data, int count, int total [,int status][,callable runAfterResponse]] @param array $options Some options:

@return Request

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/api/controller/cron.php
@line 134

forseo_disable_cron_pixel

Cron filter

Filter whether the cron pixel should be removed from current page.

@param bool $disableCronPixel

@return bool

@since 1.3.2

in /plugins/system/forseo/vendor/weeblr/forseo/controller/triggers.php
@line 119

Group: Events

forseo_onPrivacyCollectAdminCapabilities

Events filter

Hook to run the registered onAfterInitialise handlers.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 170

Group: Frontend\collection

forseo_clean_query_vars_to_strip

Frontend\collection filter

Removes common unwanted vars from a URL, before it's used.

@param array $link

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/linkscollector.php
@line 258

forseo_page_build_content_hash

Frontend\collection filter

Ask plugins to build a content hash when possible.

@param string $hash @param array $contentData @param null|Data\Page $pageData

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pagedatacollector.php
@line 308

forseo_should_check_robots_txt_before_collecting

Frontend\collection filter

Filter whether 4SEO should check robots.txt rules before crawling a page.

@param array $links @param array $originalLinks

@return array

@since 1.0.4

in /plugins/system/forseo/vendor/weeblr/forseo/helper/linkscollector.php
@line 198

forseo_should_collect_error

Frontend\collection filter

Filter whether data for the current error should be collected.
@parma \Exception $error

@param bool $shouldCollectPageData @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pagedatacollector.php
@line 900

forseo_should_collect_page_data

Frontend\collection filter

Filter whether data for the current page should be collected.

@param bool $shouldCollectPageData @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pagedatacollector.php
@line 1075

forseo_should_collect_url

Frontend\collection filter

Filter whether a single URL should be added to the collected link table.

@param bool $shouldCollectUrl @param Data\Collected $collectedUrl

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/linkscollector.php
@line 324

forseo_should_collect_urls

Frontend\collection filter

Filter whether links collection should happen on the current page.

@param bool $shouldCollectUrls @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/linkscollector.php
@line 161

forseo_should_collect_urls_found_on_page

Frontend\collection filter

Filter whether a single URL should be added to the collected link table.
Preliminary test based only on the raw URL.
We pass in a copy of the original list of links to filter so that plugins can
override links exclusion that may have been decided by other plugins before them.

@param array $links @param array $originalLinks

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/linkscollector.php
@line 167

Group: Frontend\features

forseo_*

Frontend\features filter

Filter whether a specific feature, identified by a filter name, is allowed for this request.

@param bool $shouldRunFeature @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 1138

forseo_should_inject_ogp

Frontend\features filter

Filter whether OGP tags should be injected for this request.

@param bool $injectData @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 629

forseo_should_inject_seo_data

Frontend\features filter

Filter whether SEO Data (Structured data, OGP tags, Twitter Cards) should be injected for this request.

@param bool $injectData @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 607

forseo_should_inject_structured_data

Frontend\features filter

Filter whether structured data should be injected for this request.

@param bool $injectData @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 546

forseo_should_inject_tcards

Frontend\features filter

Filter whether Twitter Cards tags should be injected for this request.

@param bool $injectData @param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 653

Group: Frontend\meta

forseo_auto_build_description

Frontend\meta filter

Filter an automatically computed meta description for a piece of content.

@param string $autoDescription @param string $context An option string representing the context, the content type. @param string|Object $content Either a string or an object holding the content data. @param Data\Page $pageData Collected request information. @param Data\Meta $pageMeta Collected meta data about the request.

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 373

forseo_extract_page_images_from_content_data

Frontend\meta filter

Filter automatically detected images from content data object.

@param array $extractedImages @param string $context An option string representing the context, the content type. @param string $content Rendered content. @param Object $contentObject Data object holding the content data. @param Data\Page $pageData Collected request information. @param Data\Meta $pageMeta Collected meta data about the request.

@return array

@since 1.3.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 190

Group: Frontend\page

forseo_after_render_page_data

Frontend\page filter

Filter the data collected at onAfterRender about the current request.
Setting the ignore field to true will cause the data gathering process to stop
and the page data will not be stored any further.

@param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pagedatacollector.php
@line 1124

forseo_after_route_page_data

Frontend\page filter

Filter the data collected at onAfterRoute about the current request.
Setting the ignore field to true will cause the data gathering process to stop
and the page data will not be stored any further.

@param Data\Page $pageData

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pagedatacollector.php
@line 1106

forseo_components_support_plugins

Frontend\page filter

Filter the list of built-in components support plugins. This allows 3rd-party to disable
native support and replace by their own.
Remove an item from the list to disable native support. Better provide your own then.

@param array $componentsPlugins List of natively supported component.

@return bool

@since 1.0.0

in /plugins/system/forseo/platform/hooks.php
@line 89

Group: Frontend\pages

forseo_pages_insert_auto_canonical

Frontend\pages filter

Filter whether to insert an automatically computed canonical link in the current page.

@param bool $insertAutoCanonical @param Data\Page $pageData Collected request information. @param Data\Meta $pageMeta Collected meta data about the request.

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 743

Group: Frontend\privacy

forseo_analytics_cookies_allowed

Frontend\privacy filter

Filter whether using cookies from analytics providers is allowed for this request.

@param bool $cookiesAllowed @param Data\Requestinfo $requestInfo

@return bool

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/controller/pageprocessor.php
@line 919

Group: Meta

forseo_auto_description_cleanup_expressions

Meta filter

Filter regular expressions to apply to content to remove unwanted codes and markers.

@param array $descCleanupExpressions

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/meta.php
@line 88

forseo_auto_description_recommended_length

Meta filter

Filter the recommended number of characters in automatically computed description.

@param int $metaAutoDescRecommendedLength

@return int

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/meta.php
@line 65

Group: Output

forseo_onAfterRenderComplete_body

Output filter

Filter the body of the CMS response at onAfterRender.

@param string $body Body of the current request.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 530

forseo_onAfterRender_body

Output filter

Filter the body of the CMS response at onAfterRender.

@param string $body Body of the current request.

@since 1.0.0

in /plugins/system/forseo/forseo.php
@line 474

Group: Pages

forseo_page_build_content_id

Pages filter

Filter the content id of a page.

@param array $contentIdBits Array of key/values pairs @param Data\Page $pageData The page object to describe with the content id.

@return string

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/page.php
@line 59

forseo_page_canonical_or_duplicate

Pages filter

Whether passed page should be considered canonical or duplicate (automatically). Presence of a duplicate
(ie with same content_id) has already been checked.

@param int $urlType Data\Page::CANONICAL | Data\Page::DUPLICATE @param Data\Page $pageData The page object.

@return int

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/page.php
@line 410

forseo_page_is_archived

Pages filter

Filter whether the current request is for an archived page.

@param bool $isArchived @param Data\Page $pageData The page object to find whether it's archived.

@return array

@since 1.1.2

in /plugins/system/forseo/vendor/weeblr/forseo/helper/page.php
@line 551

forseo_page_modified_at

Pages filter

Filters a Page modified_at date time. Use MYSQL format (Y-m-d H:i:s), assumes UTC.

@param string $lastMod @param Data\Page $pageData The page object to find the modified_at date for.

@return string

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/page.php
@line 277

Group: Request

forseo_request_info

Request filter

Filter the list of dynamic variables used in content replacement.

@param array $expandedVariables Array of variable names/variable values to use in expansions.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/data/requestinfo.php
@line 232

Group: Routing

forseo_rule_expansion_replacement_direction

Routing filter

Filter replacement direction of wildcard characters if there are less placeholders in expansion target than in expansion source.

@param string $replacementDirection The direction to use when doing wildcard replacement. @param array $ruleSpec The rule definition that triggered the expansion. @param array $matches Result of running the rule urlSpecifiction against the current requested URL.

@return int

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/rules.php
@line 221

Group: Rules

forseo_current_request_category

Rules filter

Filter the list of default, built-in WAF block rules URL specifications.

@param array $wafRulesSpecs An array of URL specifications, such as /{*} or /blog/{*}.

@return array

@since 1.0.0

in /plugins/system/forseo/platform/components/common.php
@line 73

forseo_default_block_rules

Rules filter

Filter the list of default, built-in WAF block rules URL specifications.

@param array $wafRulesSpecs An array of URL specifications, such as /{*} or /blog/{*}.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/rules.php
@line 177

Group: Sd

forseo_sd_auto_data

Sd filter

Filter the automatically built values of a given type of structured data.

@param array $autoFieldsData @param array $autoFields @param array $spec @param Data\Requestinfo $requestInfo @param Data\Page $pageData

@return array

@since 1.3.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/sd/base.php
@line 502

forseo_sd_breadcrumb

Sd filter

Filter the current page data used to build the structured data breadcrumb.

@since 1.0.0

in /plugins/system/forseo/platform/helpers/breadcrumb.php
@line 42

forseo_sd_can_run_rule

Sd filter

Whether the assigned rule can be run on this page.
By default is null.
If a plugin can support, it sets it to true.
If a plugin says this SD type cannot exist on this page, it sets it to false.
Else leave as is.
In the end, returned value must be true (ie at least one plugin can support and no other
contradict) for the rule to run.

@param bool $canRun @param array $spec @param Data\Requestinfo $requestInfo @param Data\Page $pageData

@return bool|null

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/sd/base.php
@line 542

forseo_sd_sitelinks_search_url

Sd filter

Filter the search URL used in website sitelinks structured data.

@since 1.0.0

in /plugins/system/forseo/platform/helpers/site.php
@line 43

forseo_structured_data

Sd filter

Filter the raw data to be inserted as json-ld.

@param array $data Array of structured data.

@return array

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/injector/sd.php
@line 177

forseo_structured_data_cleanup_patterns

Sd filter

Filter the list of regular expressions to be used when cleaning up a page
of existing microdata after inserting 4SEO structured data.

@param array $patterns List of regular expressions for cleaning microdata in content. @param Data\Page $pageData Data on the current page.

@return array

@since 1.3.0

in /plugins/system/forseo/vendor/weeblr/forseo/model/injector/sd.php
@line 228

Group: Sitemap

forseo_page_should_include_in_sitemap

Sitemap filter

Whether current page should be included (automatically) in a sitemap. Presence of a duplicate
(ie with same content_id) has already been checked.

@param int $shouldInclude Data\Page::INCLUDED | Data\Page::EXCLUDED @param Data\Page $pageData The page object to find the modified_at date for. @param int $sitemapType @see Data\Sitemap

@return int

@since 1.0.0

in /plugins/system/forseo/vendor/weeblr/forseo/helper/page.php
@line 747