Are there any conventions or should I strive for consistency?
No, as long as your actions are readable, unique, and it’s clear what they do, there is no rule to follow.
Ideally the names you choose are consistent within the code you write. E.g. WooCommerce has chosen to use the woocommerce_
prefix, or when ACF uses acf\
. If you think verbs works for you then use verbs, just do it consistently and clearly.
The one thing I would say, is never have a fully dynamic name, e.g. passing a variable from a separate source assuming they’re all unique, e.g. add_action( $form_name, '...
.
Related Posts:
- How do I Make a Theme “plugin-ready”?
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Difference Between Filter and Action Hooks?
- Which hook should be used to add an action containing a redirect?
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How Do I Load My Action Earlier Enough?
- Does WP fire delete_post when trashed posts are automatically deleted?
- What’s the earliest point I can get the queried object ID?
- Is it possible to create an action hook using do_action() within add_action()?
- How can I hook into existing WordPress Bulk actions?
- Define a function outside a class and call the function using action or filter hook
- What function to hook for changes made in status and visibility of a post
- Create a plugin to change the action to which a function is hooked
- Modifying values with add_action to be sent to db
- Woocommerce – Hide a Column in Cart Table
- Hook to get image filename when it is uploaded
- Which are the hooks run before/after when a category’s deletion?
- Execute Hook on the footer or header after activating a plugin
- Namespaced action and filter tags
- Tried in different ways but sidebar not working?
- How to hook a custom user function to a wordpress core ajax action?
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- WordPress custom taxonomy check box to dropdown
- I have 2 plugins using the same wp_login action hook and one is not working
- How dynamic action login_form_{action} is working
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- How to get all queries’s results after they have executed?
- Bug: Post needs to be updated twice when adding action for save_post hook
- When does save_post hook fire on post save/update
- Add child pages to submenu automatically
- Why enqueue styles on hook?
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- How to find list of all functions bind to a particular hook from my plugin?
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- How to replace settings in WordPress plugin from a theme
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- remove different admin menu for specific users
- add_option_{$option} action hook not being called
- Does WordPress have something like timer hook?
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- how to insert content into wp_head after loop_end
- Insert plugin html content to a specific spot in the frontpage
- Apply function on all action hooks?
- Ninja Forms: Front-End Forms, Post ID?
- How to override existing plugin action with new action
- Where to store PHP files created by plugin / themes
- WordPress scheduled task is called but not executed
- How to modify post content before writing to database?
- Custom user profile, registration, login page with theme
- When is it too late to call the action wp_enqueue_scripts?
- What is the Difference between directly call a function and call a function using add_action?
- What is better way to use Bootstrap inside admin panel?
- How to register custom post types in a plugin?
- Best Practices for Creating and Handling Forms with Plugins?
- Is there a better way to implement responsive images than what WordPress uses by default?
- What for the tables ending with the meta used in database of wordpress?
- Is Dreamweaver CS5 a serious choice for theme/plugin development?
- What allows a template file from plugin to be copied in child theme and overridden?
- How to Create Custom HTML Tag on Editor in `Text(HTML)` mode
- How to filter users list on user_status field with get_users()
- Can Page Templates be Applied to Archive and Post Templates?
- Is there some way to provide the user a list of existing content in a CPT
- What is the proper method of using global $post?
- Get Time Taken By Each Action Hook in WordPress
- How to change title tag at page after loaded post?
- Remove an action by extending class and replacing it
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- Getting a WordPress Debug Strategy
- Conditional Generation of Image Sizes using add_image_size
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Does WordPress default CSS have Grids?
- How to resize WordPress images on upload to specific height and width without cropping it
- Restrict certain actions to plugin-specific admin menu pages only
- Adding tables to dashboard pages programmatically?
- Pass custom props to
- Include external po file for 3th party plugin to theme
- How to update global variables in plugin activation callback?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Hook for validating and rejecting frontend image upload
- How do I remove an action hook inside a class that is called by another class?
- WordPress Reset password Strength set to medium
- redirect_to how to make it simply work with get parameter or similar?
- Looping single post in a theme
- Custom theme and plugin updating
- problem with blank page
- grouping my widgets wordpress
- How to add something after a function
- How wordpress plugin hooks works? [duplicate]
- how many rupee or dollar charge to client to make theme [closed]
- Send Webhook when post-status is publish or trash
- Using “add_image_size” to register custom image sizes inside plugins not working
- how to catch a data from a array in WordPress
- Is there any other ways to replicating changes on live from staging without pushing from git
- Fetch Custom Woocomerce filed data and check the data avialble in Wp-user table as nicname or username using function.php