<?php
class someClass {
public function __construct($options = null, $initialize = true, $error_messages = null, $path, $qnty) {
//construct what you see fit here....
}
//etc..
}
// Action listener
add_action(
'action_name',
create_function('', "new someClass(implode(',',func_get_args()));"),
10,
5 // IMPORTANT, number of arguments your construct function accept
);
// Call the action
$options = "options";
$initialize = "initialize";
$error_messages = "error_messages";
$path = "path";
$qnty = "qnty";
do_action('action_name', $options, $initialize, $error_messages, $path, $qnty);
?>
Related Posts:
- How can I see all the actions attached to an “add_action” hook?
- Which hook callback has priority if both plugin and theme use the same hook?
- How to Use Parameters with a Do_Action Function Within PHP Tags
- How to stop or remove an action being called inside a function of an extended class
- Automatically add attributes to woocommerce product?
- wordpress plugin is not activating from widget
- Removing an action from wp_footer called in a class that’s inside a bigger class
- What is @Action in WordPress?
- add_action into another add_action not working
- Basic function call on init failing
- Are there action hooks for comments?
- Hooking into the HTML header container
- Get post content inside plugin class method
- Ajax call to php function doesn’t work PHP code
- Creating Admin Submenu Page via Class Method
- plugins_loaded action is not working properly
- Plugin Hook: Get posts
- __(): What if I have to pass in a variable?
- How can I make my custom shortcode work in a Custom HTML Widget?
- PHP Deprecated: Non-static method should not be called statically
- WordPress Hook that will run when media file deleted
- Post source link plugin – small modification
- delay function on publish?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Check if a class exists within a method
- Can a plugin add to header/footer/body content?
- How can I make the “Preview Post” button save and preview in the same window?
- Escape special characters in image link
- Cannot run the code after I activate the plugin
- Displaying admin notice dynamically
- Get total number of comment of the posts written by an author
- add action for displaying posts using a shortcode
- printf – problem to understand code
- Auto delete WordPress users according to time
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- add_query_arg not working
- Programatically download a plugin
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- WordPress filter that hook after each action/filter hook
- Theme my Login plugin, how to update fields
- CSS from textarea in options page to frontend what to do
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- add image crop function like in wp customizer
- How to get post ID with hooks publish_post, new_to_publish, etc
- WordPress call_user_func_array() expects parameter 1 to be a valid callback, class
- Is wp-app.php or wp-apps.php needed for WordPress?
- How to add apply_filter for a class property in plugin
- Warning: Use of undefined constant list_all – assumed ‘list_all’ (this will throw an Error in a future version of PHP)
- How to distinguish if a plugin is not installed or just not active
- JavaScript in a PHP plugin
- Checking the count within a foreach loop
- Create a post builder skin in a plugin
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Hook for page Request?
- A server-side hook failed when committing plugin code to SVN
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- Need to replace Currency Shortforms
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- How to use printf to output two links?
- File Uploader – Upload without adding to Media Library
- Building a plugin into a theme
- 2 wordpress site same database
- Retrieve options set through a plugin
- How to redirect to a page after the form is submitted
- Trying to include files in plugin isn’t working
- Running a function with args in add_action()
- WP Insert Post If user refreshes override new post
- Displaying page content from plugin, inside exising empty WP page
- How to makes changes on the shop/category/tag pages but not on the product pages in woocommerce?
- implement custom roles in custom plugin
- How to get current cart values using WC_Shortcodes?
- How to authorize viewing and clicking a function only logged users?
- Callback hooked to post_updated firing on new posts as well
- How to arrange custom posts in the backend/admin by custom taxonomy
- Discern a specific plugin’s action hooks
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- the content of the uploads folder gets deleted periodically, how to figure out what causes it?
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- implement checkbox or toggle switch in plugin code
- Custom Field used to allow a Free Story; no longer works
- How to send new visitor to a splash page for only one time in wordpress?
- Cron job shedules replace?
- Can i add custom code in Source in specific page, Header from function.php?
- GET web api method from a WordPress PHP script
- Adding link on title its in description but not in title see screenshots attached
- how to repeat taxonomy in different places on wordpress
- How to save information related to post in database?
- Save selectlist value (taxonomy) in wp:wp_set_object_terms
- Page doesn’t load
- Removing this filter added by a plugin
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Xml output not places where i want
- Which filters or actions involve with index page for plugin?
- WordPress Plugin Receive a Link
- How to fix ‘Call to undefined function do_settings()’ error?
- Passing an input variable through a switch statement
- Posts in Admin only display 1 Post instead of all Post in admin area
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- plugin doesn’t retrieve data from database