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 customize password reset message page on success if no error in password reset
- replacing jquery google cdn with a new version dynamically
- Prevent plugin activation and add admin notice
- How do I make two shortcode use the same id and increment it when I use them multiple times?
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- call a function when insert and update a custom post type
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Is it possible to modify an Elated plugin portfolio-list template in such a way that it will not conflict with future plugin updates?
- How to embed or integrated a custom WordPress Widget into the theme?
- Post Pagination does not working on WP-Query
- How to destroy or dispose wordpress uploder/manager?
- Unable to show a message after plugin activation
- How to CRUD from wordpress database in wordpress theme?
- plugin modal/popup integration best practice
- Function not working on any file other than the main plugin file
- Woocommerce Custom Checkout
- Dynamic sidebar areas not working on the Theme Customizer
- Caption Shortcode: what filter to change the image size?
- Looping single post in a theme
- Font Awesome stopped showing icons, shows &# text instead [closed]
- Multi hook deploiement
- Merge Codes using redux framework
- To remove rendering of menus and header, plugin or theme?
- To remove rendering of menus and header, plugin or theme?
- Can I use a hook other than ‘init’ to handle form submissions?
- Managing Custom Designed Content
- action callback, for action dispatched as reported by hook sniffer, not called
- Template file structure , wordpress hook for altering the template
- woocommerce single product page hook not working
- WordPress permalink setting
- Custom theme and plugin updating
- Issue on Getting Images URL of the Post Gallery
- Best practice: What belongs in theme and what in plugin for large eCommerce website
- How can I add recent posts to menu like mashable
- Is there a general way to get a themes primary colour?
- variable created in page.php is null inside of header.php
- Issue on Getting WP Gallery Items In cpt-single.php As Attachments
- Plugin Hook: Get posts
- Generate activation url
- Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent
- problem with blank page
- What is the use of wp_schedule_event hook?
- How to Register/Link to .js Files in WordPress Dynamicaly in Header.php
- grouping my widgets wordpress
- Display Data’s metabox in page
- Updating Style From WP Options Setting Page
- Ajax functions – no access to wp-admin.php only online
- How do I replace title with my plugin?
- Create and style menu
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated