Atlas

Discover the API calls and filters within our plugin to customize site behavior and augment features, with the flexibility to apply changes globally or on a per-page basis.

In WordPress, filters allow you to modify data before it's used by the system or sent to the browser.

add_filter

You can check official documentation here.

  1. add_filter is used to hook a function or method to a specific filter action.
  2. WordPress core (or plugins) can define these filter actions at specific points in their code, usually just before output is generated or data is saved. This is done using the apply_filters function.
  3. When the apply_filters function is called, WordPress will execute all functions hooked to that filter action in the order they were added. The data is passed from one function to the next, allowing each to modify it.
  4. The final result is then returned by apply_filters and used by the calling code.
add_filter('example_filter', '__return_true');
add_filter('example_filter_2', '__return_false');

The __return_true is a built-in WordPress function that simply returns true, overriding the original setting value. You can use __return_false in the same way as __return_true when using the add_filter function. It allows you to override the original value of a setting or a feature and force it to be false.


has_filter

You can check official documentation here.

The has_filter function is used to check if a function has been attached to a specified filter in WordPress. If a function is attached to the filter, has_filter will return the priority at which the function is executed. If no function has been attached to the specified filter, it returns false. This functionality is useful for conditionally executing code based on whether a filter has a specific function attached or not.


100 %