1. Home
  2. Docs
  3. 404 to 301
  4. Actions and Filters for developers

Actions and Filters for developers

404 to 301 comes with a range of so-called filter and action hooks. These hooks allow you to modify certain functionality in the plugin without having to edit the plugin files itself.

Note: This doc is not completed yet. As of now, you may not find all the available hooks here.

As you know, there are two types of hooks: actions and filters.

  • Filters allow you to intercept and modify data as it is processed.
  • Actions allow you to execute code at specific points in a process.

Available Filters

These are the available filters that you can make use of. If you have recommendations, please free to create a pull request or contact us.

Settings & General Filters

General filters for global functions and settings of the plugin.

jj4t3_redirect_enabled

Enable or Disable global redirect option.


jj4t3_email_notify_enabled

Enable or Disable email notification.


jj4t3_log_enabled

Enable or Disable error logging.


jj4t3_redirect_to

Alter redirect to value. Accepts only 2 values – page and link.


jj4t3_redirect_type

Alter redirect type value. Accepts HTTP status codes for redirects.

Note: If you are adding custom HTTP status codes, please make sure that you have added this value to jj4t3_redirect_statuses filter too. Otherwise, it will skip and use default value


jj4t3_is_human

Alter human vs bot/crawler check. Return true it set the visitor as a real human. This check is performed to skip email notifications and error logging for bots and crawlers.

Parameters:

  • true/false – to set human or bot.
  • mobile/desktop – current device type if not bot (It will return desktop for bots also).

jj4t3_redirect_statuses

Filter to set new HTTP status codes for redirects. By default 301, 302 and 307 will be there. Please do not remove these values.

Accepts HTTP status codes for redirectsAs mentioned previously, jj4t3_redirect_type filter has a dependency on this filter.


 

Error Log Listing Filters

Filters available for error logs listing alteration.

jj4t3_log_columns

Filter the available columns in error log listing. Array of columns with column name as key and Label as value. These values are used in filters, and listing table columns.


jj4t3_logs_list_per_page

Filter to alter no. of items listed per page. By default, this value is 20. This filter will override the value set from the screen options in listing page.


jj4t3_logs_list_result

Alter the result generated by SQL query for listing error logs. This result will be after sorting, filtering and pagination.

Danger Alert: Using this filter is not recommended. If you alter the structure, the entire listing table may be affected.

You may add your custom data as result, or alter the return result. This data will be used by listing table for rendering the output.


jj4t3_log_list_orderby

Filter to alter the log listing order by field. Only allowed fields can be used (allowed values can be altered using jj4t3_log_list_orderby_allowed filter). The default value will be “date”.


jj4t3_log_list_orderby_allowed

Filter to alter the log listing order by field. Only allowed fields can be used (allowed values can be altered using jj4t3_log_list_orderby_allowed filter). The default value will be “date”.

These values should be there in jj4t3_log_columns filter’s values.


jj4t3_log_list_order

Filter to alter the log listing order (Ascending or Descending). Only ASC and DESC will be accepted. The default value will be “DESC”.


jj4t3_log_list_groupby_allowed

Allowed fields for grouping error log items. These values should be there in jj4t3_log_columns filter’s values.


jj4t3_log_list_groupby

Change grouping field in error logs listing. This should be allowed in jj4t3_log_list_groupby_allowed filter.

Warning: This filter may not be used to change the total value. Use this filter to change the total value type (like decimal).

Default value is the total returned from database result.

Was this article helpful to you? Yes 2 No

How can we help?