What you did, is do_action
with a single parameter.
File: wp-includes/plugin.php
417: * @param string $tag The name of the action to be executed.
418: * @param mixed $arg,... Optional. Additional arguments which are passed on to the
419: * functions hooked to the action. Default empty.
420: */
421: function do_action($tag, $arg = '') {
Since PHP is a liberal language you can also add multiple parameters to the do_action
and later use the number of parameters in te add_action
4-th argument.
function _hookgenerator( $name ) { do_action($name); }
Feel free to test since this is how you can make it work.
In this example, I haven’t used hook arguments at all. Maybe after some thinking, you will not need that also.
Related Posts:
- wp_enqueue_scripts not called on search page?
- When to use is_home() vs is_front_page()?
- get_template_part vs action hooks in themes
- Theme Activate Hook
- Using classes instead of global functions in functions.php
- Add custom classes to anchor in wp_nav_menu
- How to remove the Theme Customization Button from the dashboard and themes options page?
- What are the ADVANTAGES of ORIGINAL wordpress template structure?
- Change admin bar to default:off
- Getting instance variable in scope of ‘wp_enqueue_scripts’
- How to change admin bar color scheme in MP6 / WP 3.8 front end?
- Template for individual post designs
- When to use esc_url, esc_html, esc_attr, and friends?
- Display a different theme for not logged-in users
- Best practices – Should I create a child theme vs. customizing a framework theme? (such as HTML5 reset)
- Why isn’t is_home() working correctly?
- How can you develop on a live WordPress installation that is using W3 Total Cache? [closed]
- What can I hook into after_setup_theme?
- How to disable 3.1 “Admin Bar” via script for the admin user?
- What is the best practice for customizing a plugin’s JavaScript/jQuery?
- Identifying the priority of style.css so I can make a small CSS file load last
- Get password when user registers and save it sha1 into database
- Front End Post Submit Form
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- Feature Survey – What would you want in a resume theme?
- How the WordPress sidebar works
- Passing variable in hooks and filter
- Should we localize custom-made themes / plugins?
- Change loop order via form or link (jquery, not URL)
- Extend walker – navigation, adding data attribute to a tag
- How can I remove the Static Front Page option from the Customizer
- Set front page as static page [closed]
- How to programmatically bring back “excerpts” field in post editor in WP 3.1+
- How can i customize the comment list
- How to add custom template tag in wordpress theme?
- How should I store global information such as a phone number so that it is editable through the CMS?
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- How to handle theme customization and sass variables
- wp_head() not inserting the default stylesheet style.css
- Upgrading a custom theme through the Dashboard
- First completely customized theme, where should I start?
- WordPress how to override function adjacent_posts_rel_link_wp_head() in link-template.php the correct way
- Theme Customizer not loading
- Responsive Images – Generating multiple images from Theme Customizer control upload?
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Modify Javascript Configuration Options for Theme Customizer Colour Picker
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Best approach to create sites with Modular Content? [closed]
- Modify the Additional CSS section (adding a disclaimer)
- What’s the best action to use when you want to do something only once per theme setup?
- Version control for both Vagrant config and themes being developed [closed]
- Customizer API and add_panel(). Panel doesn’t show
- How to correctly add JQuery in a WP theme?
- What is the best way to handle multiple calls to get_template_directory_uri() and similar functions?
- Why is the Links Manager visible?
- Best way to start becoming a wordpress developer
- How to add theme support?
- How to add a second stylesheet to the editor
- Removing non native customizer settings from a child theme
- How to reorganize the items returned by wp_list_comments()?
- Should I use function_exists() and/or add_action() in theme development?
- which is the best way to customize nav-menu-template.php?
- Where should I update_options in a theme?
- WP 3.1 upgrade breaks AutoFocus+ theme
- Highlight “Show all” item in wp_list_categories
- Menu item added in wp_nav_menu_items filter is never highlighted
- Displaying recent post excerpts on static front page
- Customizer: Unique identifier that distinguishes which image upload control is uploading an image
- Conditional statement to show pagination
- Injecting a custom sql query into a page/theme
- How to make theme elements customizable in wordpress?
- Single-level menu option? Another way?
- How to create a custom template to admin dashboard
- How to change database values on theme update
- How do I Add images uploaded in the post to a default custom field
- How to add a button which saves the post then executes a function
- Limitations when modifying wp_title with a filter
- Pass variable to hook. Its possible?
- How to make animated intro?
- What is the “correct” way to add hooks or similar PHP behavior to a blocktheme?
- How to edit theme functions file to modify pagination?
- Show notice just below the search form on the themes page
- Default image size not working
- Theme Development: Starter Content after hook
- How to display all subpages and short by year
- Getting custom posts by post id from cutomizer text input
- Disabling Customizer Selective Refresh shortcut icons for selected controls
- JavaScript stops working on selectively refreshed sections one inside the other
- StoreFront product pages: Turn the Short Description section into a kindred tab section [closed]
- Best place for short bio,image and button [closed]
- “Add A Widget” button in the Customizer
- Zoom on custom theme without child
- Customizer: save setting/control content to post/page
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Move default page templates to sub directory
- Changing a slider to a grid [closed]
- Custom Navigation build using wp_nav_menu and walker
- Using My Own Classes On Wp Unit Tests
- Is it possible to visually group items on the theme customizer?
- Theme Customizer not loading JS for live preview