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()?
- Best practices – Should I create a child theme vs. customizing a framework theme? (such as HTML5 reset)
- What can I hook into after_setup_theme?
- How to disable 3.1 “Admin Bar” via script for the admin user?
- 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
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How the WordPress sidebar works
- Passing variable in hooks and filter
- Should we localize custom-made themes / plugins?
- Extend walker – navigation, adding data attribute to a tag
- How can I remove the Static Front Page option from the Customizer
- How can i customize the comment list
- How to handle theme customization and sass variables
- wp_head() not inserting the default stylesheet style.css
- 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
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Best approach to create sites with Modular Content? [closed]
- What’s the best action to use when you want to do something only once per theme setup?
- 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?
- How to add theme support?
- How to add a second stylesheet to the editor
- How to reorganize the items returned by wp_list_comments()?
- Should I use function_exists() and/or add_action() in theme development?
- Conditional statement to show pagination
- 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?
- How to edit theme functions file to modify pagination?
- 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
- StoreFront product pages: Turn the Short Description section into a kindred tab section [closed]
- Best place for short bio,image and button [closed]
- Zoom on custom theme without child
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Changing a slider to a grid [closed]
- Custom Navigation build using wp_nav_menu and walker
- Using My Own Classes On Wp Unit Tests
- Integrate WooCommerce theme with a WordPress theme [closed]
- Dynamic menu links after header title
- How do you use WordPress for a website that’s not in a blog format?
- What are the hooks in WordPress theme development?
- Replace site title with logo when logo is uploaded in customizer using
- How to transfer one domain to another domain without losing theme options (customizer)?
- How to make theme configurable
- Extending Twenty Eleven Theme
- How to change footer credit text in Twenty Twenty One theme with a hook?
- Templates without a loop, best practice?
- Modify available templates (in dropdown)
- Difference between “comment_form_default_fields” AND “comment_form_fields”
- searchform.php doesn’t work properly
- CSS added through customizer neglects the need of a child theme?
- Customizer: get_preview_url() inside customize_save_after hook
- Is There A WordPress Hook for Accessing Attachments for A Particular Page?
- How to add custom meta box when you have a custom page template file
- Clearing dummy data before launch
- How to call a widget in a loop at a specific iteration value?
- Right procedure when you develop a WP Website for a client
- New to WordPress – Read the Codex, Other Docs; Still Confused
- Create theme for mobile phones and tablets only?
- How to add custom page elements to the WYSIWYG editor?
- Using the media library for theme customization
- Alternatives to handle customizer settings
- My contact form – I’ve changed the source code but the changes are not being applied
- How to custom category template based on category?
- What is difference between add_theme_support and Theme Customization API?
- Put CSS Content inside tag for WordPress
- Is hand coding required at all?
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]
- How to hook into wordpress upgrade procedure for a custom theme
- Alter theme pages on language switch
- Add a customize control depending wich radio setting is checked
- WordPress Customizer Help with FontAwesome Icon
- Undefined index: custom_sidebars
- How to share posts (and plugins) between existing site and new, separate dev/test installation?
- How to prevent XSS attack in wordpress theme?
- page.php is not called when I load a Page
- WordPress 3.5 + Foundation 5 not working on IE9
- Theme Option’s Save Button is not working
- Turning WordPress Into full-featured website?
- Best practice to create required pages
- Permalinks problem with custom theme
- How to split the site’s layout without damaging this layout? [closed]
- Multiple content areas with Gutenberg – Transparent areas mid content
- How to set up a development/staging site to make major changes to the theme then update on the live site?
- Add text when displying attribute with a hook on single product page