Hook naming

The newfold/context/type/name convention for custom action and filter hooks

Id wp-hooks-naming Applies to pluginthememodule Status active Enforceable yes, no check yet Tags wordpresshooksnamingactionsfilters

A consistent naming convention for hooks is crucial when developing WordPress themes or plugins to ensure readability and maintainability. Below is a standardized approach to naming action and filter hooks tailored to Newfold Digital’s development practices.

Naming conventions

General structure

Actions

General form: newfold/[context]/action/[actionName]

Action name: Action names should always use camel case and should always start with a lowercase letter. The following scenarios may also apply when creating an action name:

Examples:

Filters

General form: newfold/[context]/filter/[filterName]

Filter name: Filter names should always use camel case and should always start with a lowercase letter. The following scenarios may also apply when creating a filter name:

Purpose-specific naming: Filters should have names that clearly reflect the value they modify or the decision they influence.

Examples:

Usage guidelines

This naming convention provides clarity and aligns with best practices, ensuring that all developers, regardless of their familiarity with the project, can understand and use the hooks efficiently.